|
@@ -165,8 +165,6 @@
|
|
|
this.drawControl = new window.L.Control.Draw(options);
|
|
|
this.map.addControl(this.drawControl);
|
|
|
this.map.on(window.L.Draw.Event.DRAWSTART, function (e) {
|
|
|
- debugger
|
|
|
- let sourceTarget = e.sourceTarget;
|
|
|
let layerType = e.layerType;
|
|
|
if(layerType === "marker"){
|
|
|
let icon = new window.L.Icon({
|
|
@@ -176,7 +174,9 @@
|
|
|
popupAnchor: [-3, -40],
|
|
|
shadowSize: [41, 41],
|
|
|
})
|
|
|
- sourceTarget.options.icon=icon;
|
|
|
+ let latLngGroup = window.L.layerGroup(null)
|
|
|
+ e.layer=latLngGroup
|
|
|
+ e.layer.options.icon=icon;
|
|
|
}
|
|
|
});
|
|
|
this.map.on(window.L.Draw.Event.CREATED, function (e) {
|
|
@@ -198,7 +198,7 @@
|
|
|
let end = latlng[i + 1];
|
|
|
dis += window.L.latLng([start.lat, start.lng]).distanceTo([end.lat, end.lng]);//计算两个点之间的距离,并累加
|
|
|
}
|
|
|
- //结果得到的也是number类型,单位是 米
|
|
|
+ //结果得到的也是number类型,单位是KM
|
|
|
modal.msg((dis / 10e2).toFixed(2) + "km");
|
|
|
}
|
|
|
})
|
|
@@ -586,20 +586,6 @@
|
|
|
controlLevel: function (level) {//控制地图缩放级别
|
|
|
this.map.setZoom(level)
|
|
|
},
|
|
|
- // handleMapEvent(div, map) {
|
|
|
- // debugger
|
|
|
- // if (!div || !map) {
|
|
|
- // return
|
|
|
- // }
|
|
|
- // div.addEventListener('mouseover', function() {
|
|
|
- // this.map.scrollWheelZoom.disable()
|
|
|
- // this.map.doubleClickZoom.disable()
|
|
|
- // })
|
|
|
- // div.addEventListener('mouseout', function() {
|
|
|
- // this.map.scrollWheelZoom.enable()
|
|
|
- // this.map.doubleClickZoom.enable()
|
|
|
- // })
|
|
|
- // }
|
|
|
}
|
|
|
}
|
|
|
</script>
|