Commit e78898a0 authored by 纪泽龙's avatar 纪泽龙

gis地图优化,地图模式优化以及解决一个编辑过程中的bug

parent 304d92e7
......@@ -330,7 +330,7 @@ class gaodeMap {
}
// 如果是新建状态 不出弹框
if (this.view.targetNum == 1) return;
console.log(e.target)
let options = map.getStatus();
options.scrollWheel = false;
map.setStatus(options);
......@@ -640,10 +640,13 @@ class gaodeMap {
// 如果是戍边浮动出现infowindow 就让窗口在固定的位置出现,这样就不显得乱了
if (e.type == "mouseover") {
const { coordinates } = polyline.getExtData().lineData;
const coordinates=polyline.getPath().map(item=>{
return [item.lng,item.lat ]
})
// const { coordinates } = polyline.getExtData().lineData;
// 计算出前两个点的中点
const arr1 = eval(coordinates)[0];
const arr2 = eval(coordinates)[1];
const arr1 = coordinates[0];
const arr2 = coordinates[1];
const a = this.centerNum(arr1[0], arr2[0]);
const b = this.centerNum(arr1[1], arr2[1]);
const a2 = this.centerNum(a, arr1[0]);
......
......@@ -54,6 +54,8 @@ class gaodeMap {
view = null;
handleInfoWindowOpenFunc = null;
onceFlag = false;
用来判断点击左边抽屉列表的时候移动才消失
leftListClick=false;
//构造函数中设置中央点默认值
constructor(center) {
this.markers = [];
......@@ -99,6 +101,10 @@ class gaodeMap {
// 地图开始平移删除infowindow
this.myMap.on("movestart", () => {
// console.log("地图平移");
if (this.leftListClick) {
console.log("moveStart");
this.closeInfoWindow();
}
// this.closeInfoWindow();
});
......
......@@ -89,7 +89,7 @@
ref="drawer"
class="drawer"
:class="{ back: backFlag, opacity: drawerOpacity }"
@mousedown="drawerClick"
@click.stop="drawerClick"
>
<div class="switch" @click="backFlag = !backFlag">
<img v-if="!backFlag" src="@/assets/images/l.png" alt="" />
......@@ -165,7 +165,7 @@
:class="{ topActive: index == 0 }"
v-for="(iten, index) in item.list"
:key="iten.deviceId + `` + index"
@click="panToo(iten, item)"
@click.stop="panToo(iten, item)"
>
<div class="no">{{ iten.no + 1 }}</div>
<div :title="iten.code" class="code">
......@@ -190,7 +190,7 @@
:class="{ topActive: index == 0 }"
v-for="(iten, index) in item.list"
:key="iten.deviceId + `` + index"
@click="panToo(iten, item)"
@click.stop="panToo(iten, item)"
>
<div class="no">{{ iten.no + 1 }}</div>
<div :title="iten.troubleLevel" class="code">
......@@ -215,7 +215,7 @@
:class="{ topActive: index == 0 }"
v-for="(iten, index) in item.list"
:key="iten.deviceId + `` + index"
@click="panToo(iten, item)"
@click.stop="panToo(iten, item)"
>
<div class="no">{{ iten.no + 1 }}</div>
<div :title="iten.userName" class="code">
......@@ -820,6 +820,8 @@ export default {
panToo(iten, item) {
// 如果没打对勾,就啥也不干
if (!this.leftBarNum.includes(item.value)) return;
// 点击的时候允许infowindow消失
this.gaoMap.leftListClick = true;
// 如果地图太大了就吸纳是不出来infowindow了,所以要固定缩放比例
// 所有线条颜色还原
this.gaoMap.polyLinesColorClear();
......@@ -882,6 +884,7 @@ export default {
iten.infoPath[1] - (lat + 0.1) >= 0 &&
iten.infoPath[1] - (lat + 0.1) <= 0.00001
) {
this.gaoMap.leftListClick = false;
this.gaoMap.polylineMouseOver(e);
target.setOptions({ strokeColor: "#F7FE38" });
return;
......@@ -905,6 +908,7 @@ export default {
};
// 如果是原地不动,就直接执行
if (iten.path[0] == lng && iten.path[1] == lat + 0.1) {
this.gaoMap.leftListClick = false;
this.gaoMap.infoOpen(e);
return;
}
......@@ -925,7 +929,7 @@ export default {
};
// 如果是原地不动,就直接执行
if (iten.path[0] == lng && iten.path[1] == lat + 0.1) {
console.log("??????");
this.gaoMap.leftListClick = false;
this.gaoMap.troubleOpen(e);
return;
}
......@@ -947,6 +951,7 @@ export default {
};
// 如果是原地不动,就直接执行
if (iten.path[0] == lng && iten.path[1] == lat + 0.1) {
this.gaoMap.leftListClick = false;
this.gaoMap.wokerManOpen(e);
return;
}
......@@ -1373,7 +1378,9 @@ export default {
this.troubleObj = obj;
},
drawerClick() {
console.log("drawerClick");
this.gaoMap.polyLinesColorClear();
this.gaoMap.closeInfoWindow();
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment