Kaynağa Gözat

优化交互&修复双指平移问题等

zjs_project 1 yıl önce
ebeveyn
işleme
92e30fb4e2

+ 4 - 2
src/components/newBottomCom/viewCareful/viewCareful.vue

@@ -118,7 +118,9 @@
 			updataData(spaceId,layoutObj){
 				let lable = this.carefulList.find(it=>it.spaceId == spaceId);
 				let name = spaceTypes[layoutObj.type - 1];
-				lable.name = name;
+				if(lable){
+					lable.name = name;
+				}
 				console.warn("***updataData***",lable)
 			},
 			sliderChanging(e,item) {
@@ -151,7 +153,7 @@
 					clkId: 'clk_2cmina_23080405', //点击ID
 					clkName: 'zoomin_clk', //点击前往的页面名称
 					clkParams: {
-						locusName: this.curHouseObj.houseType + "·" + this.curHouseObj.houseArea,
+						locusName: this.curHouseObj.houseType + "·" + this.curHouseObj.houseArea + " " + this.curHouseObj.note,
 						locusValue:this.carefulList[index].name + "面积由" + parseFloat(item.area).toFixed(1)
 						+ "㎡调整为"+ value + "㎡",
 					}

+ 1 - 1
src/components/newBottomCom/viewPlot/viewPlot.vue

@@ -159,7 +159,7 @@
 					clkId: 'clk_2cmina_24012302', //点击ID
 					clkName: 'option_clk', //点击前往的页面名称
 					clkParams: {
-						locusName: this.curHouseObj.houseType + "·" + this.curHouseObj.houseArea,
+						locusName: this.curHouseObj.houseType + "·" + this.curHouseObj.houseArea + " " + this.curHouseObj.note,
 						locusValue: typeName + "调整为" + newTypeName + "-" + optionName,
 					}
 				};

+ 4 - 1
src/mixins/loadModel.js

@@ -429,6 +429,7 @@ export default {
 									}
 								}
 							})
+							instancedMesh.material.opacity = 0.8;
 							instancedMesh.userType = "layoutMesh";
 							if(realData.name.includes("BP_L_carpet01")){//地毯接收阴影
 								instancedMesh.receiveShadow = true;//对象是否接收阴影
@@ -524,7 +525,9 @@ export default {
 					// instancedMesh.getMatrixAt(curMeshIndex,stratMatrix);//获取当前几何体的四维矩阵到stratMatrix里面
 					
 					// instancedMesh.instanceMatrix.needsUpdate = true;//更新之前,必须开启开关
-					instancedMesh.visible = isShow;
+					if(instancedMesh && instancedMesh.hasOwnProperty('visible')){
+						instancedMesh.visible = isShow;
+					}
 					// instancedMesh.setMatrixAt(curMeshIndex,stratMatrix);//更新几何体的世界矩阵
 				})
 			}

+ 13 - 56
src/pages/webgl_rxdz_test/webgl_rxdz_test.vue

@@ -132,6 +132,7 @@
 				fixedArea:0,	//初始面积值
 				layoutArea:0,	//总面积
 				selectSpace:null,//
+				changeStatus:false,
 			}
 		},
 		beforeDestroy() {
@@ -868,7 +869,7 @@
 			calculateSpaceData(curSpace, data){
 				let that = this;
 				this.curSpaceObj = curSpace;
-			
+				this.changeStatus = true;
 				// 计算宽高移动数值 
 				const changeArea = data.area;
 				const isZoomIn = data.isZoomIn;
@@ -927,54 +928,50 @@
 					that.overChange = false;
 					that.callBackFun && that.callBackFun(true);
 					// that.calculateLayoutModelSize(); //重新计算家具位置
-					that.updateWallModels(); // 替换墙体模型
-					that.changeLayoutModel(); // 改变空间模型
+					if(that.changeStatus){//空间有变化才触发替换等动作
+						that.updateWallModels(); // 替换墙体模型
+						that.changeLayoutModel(); // 改变空间模型
+					}
 					// that.changeLayoutModelState(true); // 显示家具模型
 				}, 4200);
 			}, 
 			moveSpace(curSpace, directionIndex, directionIndex01, isZoomIn, newArea, newWidth, newHeight, changeWidth, changeHeight){
 				let that = this;
-			
 				const wallLock =  this.currWallLock(directionIndex, curSpace); //南边
 				const wallLock01 =  this.currWallLock(directionIndex01, curSpace); //东边
-			
 				console.log("移动空间", wallLock, wallLock01)
-			
 				if(wallLock ==-1 && wallLock01 == -1){
+					this.changeStatus = false;//表示无变化
 					return this.$message.warning("空间尺寸已锁定");
 				}
 				let changeValue = changeHeight;
 				if(wallLock == -1){
-					
 					if(wallLock01 == 0){
 						directionIndex01 = directionIndex01 == 4 ? 3 : 4; // 往西移动
 					}
-			
 					// 南北锁死,重新计算移动的方向
 					newWidth =  newArea / (curSpace.spaceHeight / 100) * 100
 					changeWidth = newWidth / 100 - curSpace.spaceWidth / 100;
 					changeWidth = Math.abs(changeWidth * 100);
 					directionIndex = directionIndex01; // 往东移动
-					
 					changeValue = changeWidth;
-			
 					console.log("高度锁死不能拉伸, 宽度变化1",newWidth, directionIndex,curSpace.spaceWidth, curSpace.spaceHeight, changeValue);
 					that.selectWall(directionIndex);
-
 					let checkResult = this.checkRightSpace(!isZoomIn, changeWidth, false, curSpace)
 					if(!checkResult.result){
 						changeWidth = checkResult.newValue
 					}
 					console.log("宽度达到极限值结果++++++++++++++", checkResult, changeWidth)
-					
 					that.moveSpaceWall(that.curWallDirection, isZoomIn, changeWidth);
+					if(changeWidth==0){
+						this.changeStatus = false;//表示无变化
+					}
 					// that.autoCreateWall(directionIndex, curSpace)
 					return;
 				}else{
 					if(wallLock == 0){
 						directionIndex = directionIndex == 2 ? 1 : 2; // 往北边移动
 					}
-			
 					if(wallLock01 == -1){
 						// 东西锁死,重新计算移动方向
 						newHeight =  newArea / (curSpace.spaceWidth / 100) * 100
@@ -986,12 +983,13 @@
 
 						let checkResult = this.checkRightSpace(!isZoomIn, changeHeight, true, curSpace)
 						console.log("高度达到极限值结果++++++++++++++", checkResult, changeHeight)
-
 						if(!checkResult.result){
 							changeHeight = checkResult.newValue
 						}
-						
 						that.moveSpaceWall(that.curWallDirection, isZoomIn, changeHeight);
+						if(changeHeight==0){
+							this.changeStatus = false;//表示无变化
+						}
 						// 自动补墙逻辑
 						// that.autoCreateWall(directionIndex, curSpace);
 						return
@@ -1038,42 +1036,28 @@
 						changeHeight = Math.abs((newHeight / 100 - curSpace.spaceHeight / 100) * 100);
 						console.log("宽度达到最小值,重新计算高度",newWidth, newHeight, changeWidth, changeHeight)
 					}
-			
-					
-					
-					
 					// if(!checkWidth || !checkHeight){
 					// 	return
 					// }
-			
 					if(changeHeight > 0){
-						
 						that.changeSpaces = [];
-						
 						that.selectWall(directionIndex);
-						
 						let checkResult = this.checkRightSpace(!isZoomIn, changeHeight, true, curSpace)
 						console.log("高度达到极限值结果++++++++++++++", checkResult, changeHeight)
-
 						if(!checkResult.result){
 							changeHeight = checkResult.newValue
 						}
-
 						that.moveSpaceWall(that.curWallDirection, isZoomIn, changeHeight);
 						// 自动补墙逻辑
 						// that.autoCreateWall(directionIndex, curSpace)
 					}
-			
 					let timeout = 0
 					if(changeWidth > 0 && changeHeight > 0 ){
 						timeout = 2100
 					}
-					
 					console.log("改变尺寸",changeWidth, changeHeight,newWidth, newHeight,  timeout, directionIndex, directionIndex01, wallLock, wallLock01)
-					
 					if(changeWidth > 0){
 						setTimeout(() => {
-							
 							that.changeSpaces = [];
 							// // 选中墙面
 							that.selectWall(directionIndex01);
@@ -1597,33 +1581,6 @@
 				}
 				this.cameraInit();
 			},
-			// async getInitData(){
-			// 	let parmas = {
-			// 		childLayout:this.childLayout || 0,
-			// 		houseId:this.houseId,
-			// 	}
-			// 	const res = await requestConfig('getHouseTypeSpaceDetailsV2', parmas, true);
-			// 	if (res.success && res.list) {
-			// 		let list = res.list || [];
-			// 		list && list.forEach((single,index)=>{
-			// 			single.layoutStruct.forEach((item)=>{
-			// 				if(item.houseJson){
-			// 					let spaceList = JSON.parse(item.houseJson);
-			// 					// 交换centerX, centerY
-			// 					for (let index = 0; index < spaceList.length; index++) {
-			// 					    var element = spaceList[index];
-			// 					    const {centerX, centerY} = element;
-			// 					    element.centerX = centerY;
-			// 					    element.centerY = centerX;
-			// 					}
-			// 					item.houseJson = JSON.stringify(spaceList);
-			// 				}
-			// 			})
-			// 		})
-			// 		console.log("户型详情列表-接口原始数据: ", list);
-			// 		this.houseList = list;//数据会同步到组件中-进而反馈更新页面数据
-			// 	}
-			// },
 			
 			onMouseMove(e){
 				return false;