mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
* Support move, rotate, reflect, delete post paste on multiselection * Improve text and error msgs for singular vs multi selections * Move `disabled` checks from actions to operations * Reproject center of rotation (closes #3667) * Cleanup tests
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
import { actionDeleteRelation } from './delete_relation';
|
|
import { actionDeleteWay } from './delete_way';
|
|
|
|
|
|
// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/DeleteNodeAction.as
|
|
export function actionDeleteNode(nodeId) {
|
|
var action = 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 = actionDeleteWay(parent.id)(graph);
|
|
}
|
|
});
|
|
|
|
graph.parentRelations(node)
|
|
.forEach(function(parent) {
|
|
parent = parent.removeMembersWithID(nodeId);
|
|
graph = graph.replace(parent);
|
|
|
|
if (parent.isDegenerate()) {
|
|
graph = actionDeleteRelation(parent.id)(graph);
|
|
}
|
|
});
|
|
|
|
return graph.remove(node);
|
|
};
|
|
|
|
|
|
return action;
|
|
}
|