Files
iD/js/id/actions/delete_node.js
John Firebaugh 3e45afbc5e Move history annotation to History#perform/replace
Actions are too low-level for annotations.
2012-12-07 10:35:39 -05:00

19 lines
621 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(nodeId)
.forEach(function(parent) {
graph = iD.actions.RemoveWayNode(parent.id, nodeId)(graph);
});
graph.parentRelations(nodeId)
.forEach(function(parent) {
graph = iD.actions.RemoveRelationMember(parent.id, nodeId)(graph);
});
return graph.remove(node);
};
};