mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-30 03:39:36 +02:00
Converting some actions to entity methods
The guidelines here are: Entity methods: return a modified entity don't necessarily maintain whole-graph consistency Actions: return a modified graph always maintain whole-graph consistency call entity methods liberally generally don't call other actions
This commit is contained in:
@@ -20,13 +20,10 @@ iD.actions.UnjoinNode = function(nodeId, newNodeId) {
|
||||
return;
|
||||
|
||||
var index = parent.nodes.indexOf(nodeId),
|
||||
newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags}),
|
||||
nodes = parent.nodes.slice();
|
||||
|
||||
nodes.splice(index, 1, newNode.id);
|
||||
newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags});
|
||||
|
||||
graph = graph.replace(newNode);
|
||||
graph = graph.replace(parent.update({nodes: nodes}));
|
||||
graph = graph.replace(parent.updateNode(newNode.id, index));
|
||||
});
|
||||
|
||||
return graph;
|
||||
|
||||
Reference in New Issue
Block a user