2 Incheckningar 5c914d38ad ... f652e2c8a9

Upphovsman SHA1 Meddelande Datum
  caodongdong f652e2c8a9 Merge branch 'feature_UI调整' of http://101.231.166.56:3000/elab-damai-h5/h5-webgl-program into feature_UI调整 1 år sedan
  caodongdong 71cfae3b34 优化关联空间极限值限制 1 år sedan
1 ändrade filer med 57 tillägg och 15 borttagningar
  1. 57 15
      src/pages/webgl_rxdz/webgl_rxdz.vue

+ 57 - 15
src/pages/webgl_rxdz/webgl_rxdz.vue

@@ -959,10 +959,13 @@
 					newHeight = curSpace.spaceHeightMax
 				}
 
+				newWidth = newArea * 10000 / newHeight;
+
+				
 				let changeWidth = Math.abs(newWidth - curSpace.spaceWidth)
 				let changeHeight = Math.abs(newHeight - curSpace.spaceHeight)
 
-				console.log("变化的尺寸", changeWidth, changeHeight, data, curSpace.spaceWidth, curSpace.spaceHeight);
+				console.log("变化的尺寸", changeWidth, changeHeight, newWidth, newHeight, curSpace.spaceWidth, curSpace.spaceHeight);
 			
 				if(curSpace.quadrant == 1){
 					// 默认往南 往西移动
@@ -1021,7 +1024,14 @@
 			
 					console.log("高度锁死不能拉伸, 宽度变化1",newWidth, directionIndex,curSpace.spaceWidth, curSpace.spaceHeight, changeValue);
 					that.selectWall(directionIndex);
-					that.moveSpaceWall(that.curWallDirection, isZoomIn, changeValue);
+
+					let checkResult = this.checkRightSpace(!isZoomIn, changeWidth, false, curSpace)
+					if(!checkResult.result){
+						changeWidth = checkResult.newValue
+					}
+					console.log("宽度达到极限值结果++++++++++++++", checkResult, changeWidth)
+					
+					that.moveSpaceWall(that.curWallDirection, isZoomIn, changeWidth);
 					// that.autoCreateWall(directionIndex, curSpace)
 					return;
 				}else{
@@ -1085,10 +1095,9 @@
 						console.log("宽度达到最小值,重新计算高度",newWidth, newHeight, changeWidth, changeHeight)
 					}
 			
-					// let checkWidth = this.checkRightSpace(!isZoomIn, changeHeight, true)
-					// let checkHeight = this.checkRightSpace(!isZoomIn, changeWidth, false)
 					
-					// console.log("达到极限值++++++++++++++", checkWidth, checkHeight, changeWidth,changeHeight)
+					
+					
 					// if(!checkWidth || !checkHeight){
 					// 	return
 					// }
@@ -1098,8 +1107,9 @@
 						that.changeSpaces = [];
 						
 						that.selectWall(directionIndex);
-						// // 隐藏变化空间的家具模型,空间动画结束后显示
-						// that.changeLayoutModelState(); 
+						
+						let checkResult = this.checkRightSpace(!isZoomIn, changeHeight, true, curSpace)
+						console.log("高度达到极限值结果++++++++++++++", checkResult, changeHeight)
 
 						that.moveSpaceWall(that.curWallDirection, isZoomIn, changeHeight);
 						// 自动补墙逻辑
@@ -1119,8 +1129,12 @@
 							that.changeSpaces = [];
 							// // 选中墙面
 							that.selectWall(directionIndex01);
-							// // 隐藏变化空间的家具模型,空间动画结束后显示
-							// that.changeLayoutModelState(); 
+							// 计算
+							let checkResult = this.checkRightSpace(!isZoomIn, changeWidth, false, curSpace)
+							if(!checkResult.result){
+								changeWidth = checkResult.newValue
+							}
+							console.log("宽度达到极限值结果++++++++++++++", checkResult, changeWidth)
 							// 移动墙面
 							that.moveSpaceWall(that.curWallDirection, isZoomIn, changeWidth);
 							// 自动补墙逻辑
@@ -1174,18 +1188,26 @@
 				}
 				
 			},
-			checkRightSpace(isZoomIn, changeValue, isNS){
+			// 排查关联空间是否达到极限值
+			checkRightSpace(isZoomIn, changeValue, isNS, curSpace){
+				if(changeValue == 0){
+					return;
+				}
 				let n = isZoomIn?1:-1;
 				let l = isZoomIn?-1:1;
 				let result = true;
 				let space = null;
+				let newValue = changeValue;
 			
-				
+				console.log("排查空间",isZoomIn, changeValue,isNS, this.leftSpaces, this.rightSpaces);
 				for (let index = 0; index < this.leftSpaces.length; index++) {
 					const element = this.leftSpaces[index];
+					// 过滤掉花园判断
+					if(element.spaceType == 14 || element.spaceId == curSpace.spaceId){
+						continue;
+					}
 					let newWidth = element.spaceWidth + l * changeValue;
 					let newHeight = element.spaceHeight + l * changeValue;
-					console.log("关联左空间排查", isZoomIn, changeValue, isNS, newWidth, newHeight)
 					if(isNS){
 						if( newHeight > element.spaceHeightMax || newHeight < element.spaceHeightMin){
 							result = false;
@@ -1203,28 +1225,48 @@
 			
 				for (let index = 0; index < this.rightSpaces.length; index++) {
 					const element = this.rightSpaces[index];
+					// 过滤掉花园判断
+					if(element.spaceType == 14){
+						console.log("空间排查跳出")
+						continue;
+					}
 					let newWidth = element.spaceWidth + n * changeValue;
 					let newHeight = element.spaceHeight + n * changeValue;
-					console.log("关联右空间排查", isZoomIn, changeValue, isNS, newWidth, newHeight)
+					console.log("关联右空间排查", isZoomIn, isNS, changeValue, newWidth,element.spaceWidthMax, element.spaceWidthMin)
+					console.log("空间排查-0------", changeValue, 1000, newWidth, newValue)
 					if(isNS){
 						if( newHeight > element.spaceHeightMax || newHeight < element.spaceHeightMin){
 							result = false;
 							space = element;
+							const newHeightValue = newHeight > element.spaceHeightMax ? element.spaceHeightMax : element.spaceHeightMin;
+							newHeight = newHeightValue - newHeight;
+							console.log("空间排查-11------", changeValue, 1000, newHeight, newValue)
+							const newChangeValue = changeValue - newHeight;
+							if(newValue > newChangeValue){
+								newValue = newChangeValue;
+							}
 							break;
 						}
 					}else{
 						if(newWidth > element.spaceWidthMax || newWidth < element.spaceWidthMin){
 							result = false;
 							space = element;
+							const newWidthValue = newWidth > element.spaceWidthMax ? element.spaceWidthMax : element.spaceWidthMin
+							newWidth = newWidthValue - newWidth;
+							console.log("空间排查-12------", changeValue, 1000, newWidth, newValue)
+							const newChangeValue = changeValue - newWidth;
+							if(newValue > newChangeValue){
+								newValue = newChangeValue;
+							}
+							console.log("空间排查-2------", changeValue, newChangeValue, newWidth, newValue)
 							break;
 						}
 					}
 				}
-				console.log("空间排查", this.leftSpaces, this.rightSpaces, result, space)
 				if(!result){
 					this.$message.warning(`关联空间[${ space && space.spaceName || ''}]达到极限值`);
 				}
-				return result
+				return {"result":result,"newValue":newValue}
 			},
 			checkSpaceSize(isZoomIn, changeWidth, changeHeight){
 				console.log("检查尺寸", isZoomIn, changeWidth, changeHeight, this.leftSpaces, this.rightSpaces)