dedsudiyu 2 jaren geleden
bovenliggende
commit
b6fe8867d4
1 gewijzigde bestanden met toevoegingen van 31 en 48 verwijderingen
  1. 31 48
      pages/emergencyEvacuationBig.vue

+ 31 - 48
pages/emergencyEvacuationBig.vue

@@ -230,7 +230,7 @@
 			return {
 				videoCover: uni.getStorageSync('videoCover'),
 				//页面状态
-				pageType: "2",
+				pageType: "1",
 				deptIndex: 0,
 				//院系楼栋数据
 				buildingList: [],
@@ -993,16 +993,9 @@
 			},
 			//缩放计算
 			zoomCalculate(list, height, width) {
-				let num = 0;
-				let zoomType = 0;
 				let maxWidth = 0
 				let maxHeight = 0
 				let zoomData = 1;
-				if (height > width) {
-					num = height / width
-				} else {
-					num = width / height
-				}
 				for (let i = 0; i < list.length; i++) {
 					if ((list[i].x + list[i].w) > maxWidth) {
 						maxWidth = list[i].x + list[i].w
@@ -1011,48 +1004,38 @@
 						maxHeight = list[i].y + list[i].h
 					}
 				}
+				//处理等值数据
+				if(maxHeight == height){
+				  maxHeight--
+				}
+				if(maxWidth == width){
+				  maxWidth--
+				}
 				this.$set(this, 'mapWidth', maxWidth);
 				this.$set(this, 'mapHeight', maxHeight);
-				if (maxWidth > maxHeight) {
-					if ((maxWidth / maxHeight) > num) {
-						// 以宽度缩放
-						zoomType = 1;
-					} else {
-						// 以高度缩放
-						zoomType = 2;
-				 }
-				} else {
-					if ((maxHeight / maxWidth) > num) {
-						// 以高度缩放
-						zoomType = 2;
-					} else {
-						// 以宽度缩放
-						zoomType = 1;
-					}
-				}
-
-				if (zoomType == 1) {
-					if (width > maxWidth) {
-						zoomData = maxWidth / width;
-					} else {
-						zoomData = width / maxWidth;
-					}
-					if (width > maxWidth) {
-						this.$set(this, 'zoomData', maxWidth / width);
-					} else {
-						this.$set(this, 'zoomData', width / maxWidth);
-					}
-				} else if (zoomType == 2) {
-				 if (height > maxHeight) {
-						zoomData = maxHeight / height;
-					} else {
-						zoomData = height / maxHeight;
-					}
-					if (height > maxHeight) {
-						this.$set(this, 'zoomData', maxHeight / height);
-					} else {
-						this.$set(this, 'zoomData', height / maxHeight);
-					}
+				//缩放判断
+				if(maxHeight>height&&maxWidth>width){
+				  if((maxHeight-height)>(maxWidth-width)){
+					zoomData = height/maxHeight;
+					this.$set(this,'zoomData',height/maxHeight);
+				  }else{
+					zoomData = width / maxWidth;
+					this.$set(this,'zoomData',width / maxWidth);
+				  }
+				}else if(maxHeight<height&&maxWidth<width){
+				  if((height-maxHeight)>(width-maxWidth)){
+					zoomData = width / maxWidth;
+					this.$set(this,'zoomData',width / maxWidth);
+				  }else{
+					zoomData = height / maxHeight;
+					this.$set(this,'zoomData',height / maxHeight);
+				  }
+				}else if(maxHeight<height&&maxWidth>width){
+				  zoomData = width / maxWidth;
+				  this.$set(this,'zoomData',width / maxWidth);
+				}else if(maxHeight>height&&maxWidth<width){
+				  zoomData = height / maxHeight;
+				  this.$set(this,'zoomData',height / maxHeight);
 				}
 			},
 			//结束疏散