Przeglądaj źródła

Merge branch 'feature_UI调整' of http://101.231.166.56:3000/elab-damai-h5/h5-webgl-program into feature_UI调整

zjs_project 1 rok temu
rodzic
commit
9ab2ceb879
2 zmienionych plików z 22 dodań i 10 usunięć
  1. 5 0
      src/mixins/loadModel.js
  2. 17 10
      src/pages/webgl_rxdz/webgl_rxdz.vue

+ 5 - 0
src/mixins/loadModel.js

@@ -1178,6 +1178,11 @@ export default {
 			})
 		},
 		async loadlayoutByID(groupType,spaceObj, resolve){
+
+			if(!groupType){
+				console.log("无法通过groupType请求布局", spaceObj.spaceId);
+				return resolve();
+			}
 			let param = {
 				"brandId": $config.brandId,
 				"houseId": this.curHouseObj.houseId,

+ 17 - 10
src/pages/webgl_rxdz/webgl_rxdz.vue

@@ -150,7 +150,7 @@
 			console.log("***onLoad-webgl_rxdz***", this.$route.query)
 			var that = this;
 			this.houseId = this.$store.state.houseId || '';
-			this.childLayout = '0';//4-测试户型
+			this.childLayout = '4';//4-测试户型
 			let unit = window.screen.width / 750;//单位rpm 对应 px 的值
 			that.canvasHeight = window.screen.height - (200 * unit) + (20 * unit);
 			
@@ -931,21 +931,28 @@
 				const newArea = oldArea + changeArea * (data.isZoomIn ? 1 : -1);
 				const sizeScale = Math.sqrt(newArea/oldArea) ;
 			
+				// 新的宽度
 				let newWidth = curSpace.spaceWidth * sizeScale;
-				let newHeight = curSpace.spaceHeight * sizeScale;
 
-				if(isZoomIn){
-					newWidth = Math.min(newWidth, curSpace.spaceWidthMax)
-					newHeight = Math.min(newHeight, curSpace.spaceHeightMax)
-				}else{
-					newWidth = Math.max(newWidth, curSpace.spaceWidthMin)
-					newHeight = Math.max(newHeight, curSpace.spaceHeightMin)
+				if(newWidth < curSpace.spaceWidthMin){
+					newWidth = curSpace.spaceWidthMin
+				}
+				if(newWidth > curSpace.spaceWidthMax){
+					newWidth = curSpace.spaceWidthMax
+				}
+				// 新的高度
+				let newHeight = newArea * 10000 / newWidth;
+
+				if(newHeight < curSpace.spaceHeightMin){
+					newHeight = curSpace.spaceHeightMin
+				}
+				if(newHeight > curSpace.spaceHeightMax){
+					newHeight = curSpace.spaceHeightMax
 				}
 
 				let changeWidth = Math.abs(newWidth - curSpace.spaceWidth)
 				let changeHeight = Math.abs(newHeight - curSpace.spaceHeight)
-			
-				console.log("变化的尺寸", newWidth, newHeight, data, sizeScale);
+				
 				console.log("变化的尺寸", changeWidth, changeHeight, data, curSpace.spaceWidth, curSpace.spaceHeight);
 			
 				if(curSpace.quadrant == 1){