mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 16:49:40 +02:00
Now that updateNode preserves circularity, provide close/unclose functions
This lets us break closed ways at their connecting node in the few situations where we actually want that behavior (disconnect action for circular non-area ways)
This commit is contained in:
@@ -31,6 +31,9 @@ export function actionDisconnect(nodeId, newNodeId) {
|
||||
if (connection.index === 0 && way.isArea()) {
|
||||
// replace shared node with shared node..
|
||||
graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
|
||||
} else if (way.isClosed() && connection.index === way.nodes.length - 1) {
|
||||
// replace closing node with new new node..
|
||||
graph = graph.replace(way.unclose().addNode(newNode.id));
|
||||
} else {
|
||||
// replace shared node with multiple new nodes..
|
||||
graph = graph.replace(way.updateNode(newNode.id, connection.index));
|
||||
@@ -52,11 +55,11 @@ export function actionDisconnect(nodeId, newNodeId) {
|
||||
return;
|
||||
}
|
||||
if (way.isArea() && (way.nodes[0] === nodeId)) {
|
||||
candidates.push({wayID: way.id, index: 0});
|
||||
candidates.push({ wayID: way.id, index: 0 });
|
||||
} else {
|
||||
way.nodes.forEach(function(waynode, index) {
|
||||
if (waynode === nodeId) {
|
||||
candidates.push({wayID: way.id, index: index});
|
||||
candidates.push({ wayID: way.id, index: index });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user