2 Commits fd93b70dc4 ... 0fc7d72e07

Author SHA1 Message Date
  caodongdong 0fc7d72e07 Merge branch 'feature_UI调整' of http://101.231.166.56:3000/elab-damai-h5/h5-webgl-program into feature_UI调整 1 year ago
  caodongdong 1de4a7a97a 布局规则修改 1 year ago
1 changed files with 9 additions and 4 deletions
  1. 9 4
      src/mixins/loadModel.js

+ 9 - 4
src/mixins/loadModel.js

@@ -542,6 +542,8 @@ export default {
 	
 					if (curSpace.spaceWallInfo.wallN && curSpace.spaceWallInfo.wallS) {
 						spaceHeight -= 20 + parseFloat(cubeInfo.marginTop) + parseFloat(cubeInfo.marginBottom);
+						positionY += parseFloat(cubeInfo.marginTop) / 2 ;
+						positionY -= parseFloat(cubeInfo.marginBottom) / 2;
 					} else if (curSpace.spaceWallInfo.wallN) {
 						spaceHeight -= 10 + parseFloat(cubeInfo.marginTop) + parseFloat(cubeInfo.marginBottom);
 						positionY += 10 / 2;
@@ -573,6 +575,8 @@ export default {
 	
 					if (curSpace.spaceWallInfo.wallW && curSpace.spaceWallInfo.wallE) {
 						spaceWidth -= 20 + parseFloat(cubeInfo.marginLeft) + parseFloat(cubeInfo.marginRight);
+						positionX += parseFloat(cubeInfo.marginLeft) / 2;
+						positionX -= parseFloat(cubeInfo.marginRight) / 2;
 					} else if (curSpace.spaceWallInfo.wallW) {
 						spaceWidth -= 10 + parseFloat(cubeInfo.marginLeft) + parseFloat(cubeInfo.marginRight);
 						positionX += 10 / 2;
@@ -908,10 +912,10 @@ export default {
 				}
 	
 				// 边距
-				oldCubeInfo.marginLeft = cubeInfo.marginTop;
-				oldCubeInfo.marginTop = cubeInfo.marginRight;
-				oldCubeInfo.marginRight = cubeInfo.marginBottom;
-				oldCubeInfo.marginBottom = cubeInfo.marginLeft;
+				oldCubeInfo.marginLeft = cubeInfo.marginBottom;
+                oldCubeInfo.marginTop = cubeInfo.marginLeft;
+                oldCubeInfo.marginRight = cubeInfo.marginTop;
+                oldCubeInfo.marginBottom = cubeInfo.marginRight;
 				oldCubeInfo.modelWidth = cubeInfo.modelHeight;
 				oldCubeInfo.modelHeight = cubeInfo.modelWidth;
 	
@@ -1031,6 +1035,7 @@ export default {
 		
 			// 合适的布局更现有布局相同
 			if(spaceObj.layoutId == layoutObj.id){
+				this.calculateLayoutModelSize() // 提前计算模型的位置
 				this.changeLayoutModelState(true); // 显示家具模型
 				return resolve()
 			}