我在我的应用程序中使用可编辑的折线,并且面临可编辑点(用户可以单击并拖动)的情况并不总是沿显示行路径正确对齐 .

当缩小时,点看起来很好 .

enter image description here

我注意到当我放大时这些点看起来不对齐:

enter image description here

我没有看到这与leaflet.editable demo一起发生 .

我在传单1.3.1和传单可编辑1.1.0

我应该指出,在我正在处理的应用程序中,用户可以保存他们对折线所做的更改,并且lat \ lng将这些更改保存到后端,以便稍后可以再次呈现该行 .

我有代码,其中对于给定的'section'代表折线,存储了一个点数组,所以在下面的代码片段中你可以看到我创建LalLng数组并传递给一个函数来显示 Map 上的线:

const points: Array<L.LatLng> = [];
section.routingPoints.forEach((routingPoint) => {
    points.push(new L.LatLng(routingPoint.latitude, routingPoint.longitude));
});
this.showSectionOnMap(points);

我的show函数没有什么特别之处:

private showSectionOnMap = (points: Array<L.LatLng>, insertAt?: number) => {
    const section = L.polyline(points, { className: 'route-path' });
    section.addTo(this.map);
    section.enableEdit();
}

有没有人想到可能导致这种情况的原因?我检查过我没有自定义css干扰,例如影响这些可拖动点的定位 .

谢谢