使用产品: "@supermap/iclient-leaflet": "^11.1.1", "leaflet": "^1.9.4", "leaflet-draw": "^1.0.4", "vue": "^2.6.14" 操作系统 mac M2, 浏览器 Google
问题详细描述: 我在使用咱们地图的时候, 我地图下面还有一个组件, 上下排列, 会出现 纵向滚动条。 地图加载都是按照官方方法加载的。 然后当我滚动条滚动到下面的时候, 再点击一下地图, 滚动条又自动滚动上去了, 我业务上后面地图上会有点和线, 这种自动滚动, 捕获的点或者线,捕获的不是我鼠标刚点击到的,是滚动条又滚上去以后点到的,就很麻烦。
问题重现步骤: 滚动条拖动到底部, 点击地图, 滚动条自动滚动。
<template>
<div class="map-container">
<div id="leaflet-map" style="height: 80%; width: 100%"></div>
<div class="table">测试</div>
</div>
</template>
<script>
import "leaflet-draw";
export default {
data() {
return {
map: null,
};
},
mounted() {
window.map = this.map = L.map(document.getElementById("leaflet-map"), {
crs: L.CRS.EPSG4326,
center: [0, 0],
maxZoom: 18,
minZoom: 1,
zoom: 1,
zoomControl: false,
attributionControl: false,
editable: true,
});
L.supermap
.tiledMapLayer(
"https://iserver.supermap.io/iserver/services/map-world/rest/maps/World"
)
.addTo(this.map);
let editableLayers = new L.FeatureGroup();
let control = new L.Control.Draw({
position: "topleft",
draw: {
polyline: {},
polygon: {},
circle: false,
rectangle: false,
marker: false,
remove: false,
},
});
this.map.addControl(control);
editableLayers.addTo(this.map);
this.map.on(L.Draw.Event.CREATED, function (e) {
var type = e.layerType,
layer = e.layer;
let geo = layer.toGeoJSON();
console.log(geo);
let coordinate = geo.geometry.coordinates;
editableLayers.addLayer(layer);
});
},
};
</script>
<style>
.map-container {
height: 100%;
width: 100%;
overflow: scroll
}
.table{
height: 500px;
width: 100%;
border: 1px solid #333
}
</style>