|
@@ -1116,30 +1116,46 @@ export default {
|
|
|
this.$set(this, 'mapWidth', maxWidth);
|
|
|
this.$set(this, 'mapHeight', 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);
|
|
|
+ let zoomNumOne = height / maxHeight;
|
|
|
+ if(parseInt(this.accMul(zoomNumOne,maxHeight)) <= height && parseInt(this.accMul(zoomNumOne,maxWidth)) <= width){
|
|
|
+ zoomData = zoomNumOne;
|
|
|
+ this.$set(this,'zoomData',zoomNumOne);
|
|
|
}
|
|
|
- }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);
|
|
|
+ let zoomNumTwo = width / maxWidth;
|
|
|
+ if(parseInt(this.accMul(zoomNumTwo,maxHeight)) <= height && parseInt(this.accMul(zoomNumTwo,maxWidth)) <= width){
|
|
|
+ zoomData = zoomNumTwo;
|
|
|
+ this.$set(this,'zoomData',zoomNumTwo);
|
|
|
}
|
|
|
- }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);
|
|
|
- }
|
|
|
+ // 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);
|
|
|
+ // }
|
|
|
},
|
|
|
+ accMul(arg1,arg2){
|
|
|
+ var m=0,s1=arg1.toString(),s2=arg2.toString();
|
|
|
+ try{m+=s1.split(".")[1].length}catch(e){}
|
|
|
+ try{m+=s2.split(".")[1].length}catch(e){}
|
|
|
+ return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
|
|
|
+ },
|
|
|
//结束疏散
|
|
|
evacuationButton() {
|
|
|
let self = this;
|