mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
When deleting final nodes from a way, pan to final node's location
(closes #4541)
This commit is contained in:
@@ -18,6 +18,7 @@ export function operationDelete(selectedIDs, context) {
|
||||
|
||||
var operation = function() {
|
||||
var nextSelectedID;
|
||||
var nextSelectedLoc;
|
||||
|
||||
if (selectedIDs.length === 1) {
|
||||
var id = selectedIDs[0],
|
||||
@@ -27,7 +28,7 @@ export function operationDelete(selectedIDs, context) {
|
||||
parent = parents[0];
|
||||
|
||||
// Select the next closest node in the way.
|
||||
if (geometry === 'vertex' && parent.nodes.length > 2) {
|
||||
if (geometry === 'vertex') {
|
||||
var nodes = parent.nodes,
|
||||
i = nodes.indexOf(id);
|
||||
|
||||
@@ -42,13 +43,19 @@ export function operationDelete(selectedIDs, context) {
|
||||
}
|
||||
|
||||
nextSelectedID = nodes[i];
|
||||
nextSelectedLoc = context.entity(nextSelectedID).loc;
|
||||
}
|
||||
}
|
||||
|
||||
context.perform(action, operation.annotation());
|
||||
|
||||
if (nextSelectedID && context.hasEntity(nextSelectedID)) {
|
||||
context.enter(modeSelect(context, [nextSelectedID]).follow(true));
|
||||
if (nextSelectedID && nextSelectedLoc) {
|
||||
if (context.hasEntity(nextSelectedID)) {
|
||||
context.enter(modeSelect(context, [nextSelectedID]).follow(true));
|
||||
} else {
|
||||
context.map().centerEase(nextSelectedLoc);
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
} else {
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user