Skip to content

Commit 38788a8

Browse files
authored
fix: fix Path Edit the new vertex position error when dragstart (#2646)
* VectorTileLayer add loadTileErrorLog for log loadTile error (#2641) * VectorTileLayer add loadTileErrorLog for log loadTile error * fix typing * fix Path Edit the new vertex position error when dragstart
1 parent ad3ba1c commit 38788a8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/maptalks/src/geometry/editor/GeometryEditor.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,7 @@ class GeometryEditor extends Eventable(Class) {
12491249
}
12501250

12511251
let pauseRefresh = false;
1252+
let isSplitSegment = false;
12521253
function createNewVertexHandle(index: number, ringIndex: number = 0, ringCoordinates: Array<Coordinate>): any {
12531254
let vertexCoordinates = ringCoordinates || getVertexCoordinates(ringIndex);
12541255
let nextVertex;
@@ -1257,7 +1258,12 @@ class GeometryEditor extends Eventable(Class) {
12571258
} else {
12581259
nextVertex = vertexCoordinates[index + 1];
12591260
}
1260-
const vertex = vertexCoordinates[index].add(nextVertex).multi(1 / 2);
1261+
1262+
let vertex = vertexCoordinates[index].add(nextVertex).multi(1 / 2);
1263+
//add two "new vertex" handles
1264+
if (isSplitSegment) {
1265+
vertex = coordinatesToContainerPoint(map, vertex);
1266+
}
12611267
const handle = me.createHandle(vertex, {
12621268
'symbol': me.options['newVertexHandleSymbol'],
12631269
'cursor': 'pointer',
@@ -1292,7 +1298,9 @@ class GeometryEditor extends Eventable(Class) {
12921298
handle.opacity = 1;
12931299

12941300
//add two "new vertex" handles
1301+
isSplitSegment = true;
12951302
newVertexHandles[ringIndex].splice(vertexIndex, 0, createNewVertexHandle.call(me, vertexIndex, ringIndex), createNewVertexHandle.call(me, vertexIndex + 1, ringIndex));
1303+
isSplitSegment = false;
12961304
pauseRefresh = true;
12971305
},
12981306
onMove: function (): void {

0 commit comments

Comments
 (0)