mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 17:52:55 +00:00
They're something distinct from actions. Actions are independent of UI, operations are actions + UI (title, keybinding, modality, etc.)
24 lines
757 B
JavaScript
24 lines
757 B
JavaScript
// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/DeleteNodeAction.as
|
|
iD.actions.DeleteNode = function(nodeId) {
|
|
return function(graph) {
|
|
var node = graph.entity(nodeId);
|
|
|
|
graph.parentWays(node)
|
|
.forEach(function(parent) {
|
|
parent = parent.removeNode(nodeId);
|
|
graph = graph.replace(parent);
|
|
|
|
if (parent.isDegenerate()) {
|
|
graph = iD.actions.DeleteWay(parent.id)(graph);
|
|
}
|
|
});
|
|
|
|
graph.parentRelations(node)
|
|
.forEach(function(parent) {
|
|
graph = graph.replace(parent.removeMember(nodeId));
|
|
});
|
|
|
|
return graph.remove(node);
|
|
};
|
|
};
|