mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-26 18:07:50 +02:00
9743ee282b
Pass entities to actions via id; this allows safe composition of actions that modify the same entity. Fix remaining ghost node cases (#213). Create more logical undo states when drawing.
11 lines
468 B
JavaScript
11 lines
468 B
JavaScript
// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/AddNodeToWayAction.as
|
|
iD.actions.AddWayNode = function(wayId, nodeId, index) {
|
|
return function(graph) {
|
|
var way = graph.entity(wayId),
|
|
node = graph.entity(nodeId),
|
|
nodes = way.nodes.slice();
|
|
nodes.splice(index || nodes.length, 0, nodeId);
|
|
return graph.replace(way.update({nodes: nodes}), 'added to a road');
|
|
};
|
|
};
|