diff --git a/index.html b/index.html index 122569faa..9de339471 100644 --- a/index.html +++ b/index.html @@ -53,7 +53,7 @@ - + diff --git a/js/id/actions/move.js b/js/id/actions/move_node.js similarity index 64% rename from js/id/actions/move.js rename to js/id/actions/move_node.js index 21870c8d4..9204fcb67 100644 --- a/js/id/actions/move.js +++ b/js/id/actions/move_node.js @@ -1,8 +1,8 @@ // https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/command/MoveCommand.java // https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MoveNodeAction.as -iD.actions.Move = function(entityId, loc) { +iD.actions.MoveNode = function(nodeId, loc) { return function(graph) { - var entity = graph.entity(entityId); - return graph.replace(entity.update({loc: loc})); + var node = graph.entity(nodeId); + return graph.replace(node.update({loc: loc})); }; }; diff --git a/js/id/modes/drag_features.js b/js/id/modes/drag_features.js index 8d2eeda18..d20119080 100644 --- a/js/id/modes/drag_features.js +++ b/js/id/modes/drag_features.js @@ -21,11 +21,11 @@ iD.modes._dragFeatures = function(mode) { } else { dragging = entity; mode.history.perform( - iD.actions.Move(dragging.id, loc)); + iD.actions.MoveNode(dragging.id, loc)); } } - mode.history.replace(iD.actions.Move(dragging.id, loc)); + mode.history.replace(iD.actions.MoveNode(dragging.id, loc)); }) .on('dragend', function (entity) { if (!dragging) return; diff --git a/js/id/modes/draw_area.js b/js/id/modes/draw_area.js index 12f04d283..c31544e5c 100644 --- a/js/id/modes/draw_area.js +++ b/js/id/modes/draw_area.js @@ -24,7 +24,7 @@ iD.modes.DrawArea = function(wayId) { iD.actions.AddWayNode(way.id, node.id, -1)); function mousemove() { - history.replace(iD.actions.Move(node.id, map.mouseCoordinates())); + history.replace(iD.actions.MoveNode(node.id, map.mouseCoordinates())); } function click() { diff --git a/js/id/modes/draw_line.js b/js/id/modes/draw_line.js index b9b8e4409..74c16095f 100644 --- a/js/id/modes/draw_line.js +++ b/js/id/modes/draw_line.js @@ -25,7 +25,7 @@ iD.modes.DrawLine = function(wayId, direction) { iD.actions.AddWayNode(wayId, node.id, index)); function mousemove() { - history.replace(iD.actions.Move(node.id, map.mouseCoordinates())); + history.replace(iD.actions.MoveNode(node.id, map.mouseCoordinates())); } function click() { diff --git a/test/index.html b/test/index.html index 4edfc5197..f66c872d4 100644 --- a/test/index.html +++ b/test/index.html @@ -54,7 +54,7 @@ - + @@ -94,7 +94,7 @@ - + diff --git a/test/index_packaged.html b/test/index_packaged.html index 7222f3ae4..1c197a5b7 100644 --- a/test/index_packaged.html +++ b/test/index_packaged.html @@ -31,7 +31,7 @@ - + diff --git a/test/spec/actions/move.js b/test/spec/actions/move.js deleted file mode 100644 index 5e4163af7..000000000 --- a/test/spec/actions/move.js +++ /dev/null @@ -1,8 +0,0 @@ -describe("iD.actions.Move", function () { - it("changes an entity's location", function () { - var entity = iD.Entity(), - loc = [2, 3], - graph = iD.actions.Move(entity.id, loc)(iD.Graph([entity])); - expect(graph.entity(entity.id).loc).to.eql(loc); - }); -}); diff --git a/test/spec/actions/move_node.js b/test/spec/actions/move_node.js new file mode 100644 index 000000000..5e7c8f663 --- /dev/null +++ b/test/spec/actions/move_node.js @@ -0,0 +1,8 @@ +describe("iD.actions.MoveNode", function () { + it("changes a node's location", function () { + var node = iD.Node(), + loc = [2, 3], + graph = iD.actions.MoveNode(node.id, loc)(iD.Graph([node])); + expect(graph.entity(node.id).loc).to.eql(loc); + }); +});