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

优化地图模式,优化gis地图

parent 04f12e90
......@@ -88,7 +88,7 @@ class gaodeMap {
// 抽屉点击的时候让infowindow隐藏
if (this.leftListClick) {
console.log("moveStart")
console.log("moveStart");
this.closeInfoWindow();
}
});
......@@ -330,7 +330,7 @@ class gaodeMap {
}
// 如果是新建状态 不出弹框
if (this.view.targetNum == 1) return;
console.log(e.target)
console.log(e.target);
let options = map.getStatus();
options.scrollWheel = false;
map.setStatus(options);
......@@ -558,6 +558,9 @@ class gaodeMap {
//添加事件
polyline.on("mouseover", this.polylineMouseOver);
polyline.on("click", this.polylineMouseOver);
polyline.on("mousedown", e => {
this.polyLinesColorClear(polyline);
});
polyline.on("mouseout", e => {
polyline.setOptions({ strokeColor: "#2EE7E7" });
// infoWindow.close();
......@@ -576,14 +579,17 @@ class gaodeMap {
polylineMouseOver = e => {
console.log(e.type);
let polyline = e.target;
// 如果是无状态或者是新建并且是鼠标移入
if (this.view.targetNum == 0 && e.type == "mouseover") {
polyline.setOptions({ strokeColor: "#F7FE38" });
return;
}
// 当选择的是新建的时候,线是点不了的
if (this.lineType == 1 || this.view.targetNum == 1) return;
if((this.view.targetNum==2||this.view.targetNum==3)&&e.type=="mouseover"){
this.polyLinesColorClear(polyline);
}
// 上方导航的高
let X = 20,
Y = -20;
......@@ -640,9 +646,9 @@ class gaodeMap {
// 如果是戍边浮动出现infowindow 就让窗口在固定的位置出现,这样就不显得乱了
if (e.type == "mouseover") {
const coordinates=polyline.getPath().map(item=>{
return [item.lng,item.lat ]
})
const coordinates = polyline.getPath().map(item => {
return [item.lng, item.lat];
});
// const { coordinates } = polyline.getExtData().lineData;
// 计算出前两个点的中点
const arr1 = coordinates[0];
......@@ -669,9 +675,11 @@ class gaodeMap {
// const
};
polyLinesColorClear() {
polyLinesColorClear(polylines) {
this.polyLines.forEach(item => {
item.setOptions({ strokeColor: "#2EE7E7" });
if (item != polylines) {
item.setOptions({ strokeColor: "#2EE7E7" });
}
});
}
centerNum(num1, num2) {
......@@ -709,7 +717,6 @@ class gaodeMap {
}
// 新建line增加编辑以及右键菜单
closeInfoWindow() {
this.showInfoWindow && this.showInfoWindow.close();
this.markerInfoWindow && this.markerInfoWindow.close();
}
......
......@@ -54,8 +54,8 @@ class gaodeMap {
view = null;
handleInfoWindowOpenFunc = null;
onceFlag = false;
用来判断点击左边抽屉列表的时候移动才消失
leftListClick=false;
// 用来判断点击左边抽屉列表的时候移动才消失
leftListClick = false;
//构造函数中设置中央点默认值
constructor(center) {
this.markers = [];
......@@ -902,18 +902,23 @@ class gaodeMap {
infoWindow.setOffset(new AMap.Pixel(X, Y));
} else {
infoWindow.setOffset(new AMap.Pixel(20, -20));
this.polyLinesColorClear(polyline);
// polyline.setOptions({ strokeColor: "#F7FE38" });
}
this.boxCollision(infoWindow.dom);
this.showInfoWindow = infoWindow;
// const
};
// 所有的线的颜色归位,如果是报警的,就红色,不是就蓝色
polyLinesColorClear() {
polyLinesColorClear(polyline) {
this.polyLines.forEach(item => {
if (item.getExtData().lineData.alarmState == 1) {
item.setOptions({ strokeColor: "#ff0000" });
} else {
item.setOptions({ strokeColor: "#2EE7E7" });
if (item != polyline) {
if (item.getExtData().lineData.alarmState == 1) {
item.setOptions({ strokeColor: "#ff0000" });
} else {
item.setOptions({ strokeColor: "#2EE7E7" });
}
}
});
}
......
......@@ -389,6 +389,8 @@ export default {
}
// 关闭当前的infowindow
this.gaoMap.closeInfoWindow();
// 清除所有线的颜色
this.gaoMap.polyLinesColorClear();
this.deviceType = !this.deviceType;
this.gaoMap.mapOperateType = "add";
......@@ -448,6 +450,8 @@ export default {
}
// 关闭当前的infowindow
this.gaoMap.closeInfoWindow();
// 清空管道颜色
this.gaoMap.polyLinesColorClear();
this.createReset();
},
deleteDevice() {
......@@ -469,6 +473,8 @@ export default {
}
// 关闭当前的infowindow
this.gaoMap.closeInfoWindow();
// 清空管道颜色
this.gaoMap.polyLinesColorClear();
this.createReset();
},
selectDeviceType(val) {
......
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