diff --git a/js/id/actions/move_way.js b/js/id/actions/move_way.js index 0ef14e4f3..ea547cc44 100644 --- a/js/id/actions/move_way.js +++ b/js/id/actions/move_way.js @@ -1,11 +1,11 @@ -iD.actions.MoveWay = function(wayId, dxdy, projection) { +iD.actions.MoveWay = function(wayId, delta, projection) { return function(graph) { var way = graph.entity(wayId); _.uniq(way.nodes).forEach(function(id) { var node = graph.entity(id), start = projection(node.loc), - end = projection.invert([start[0] + dxdy[0], start[1] + dxdy[1]]); + end = projection.invert([start[0] + delta[0], start[1] + delta[1]]); graph = iD.actions.MoveNode(id, end)(graph); }); diff --git a/js/id/behavior/drag.js b/js/id/behavior/drag.js index dc947582c..fefcd2c99 100644 --- a/js/id/behavior/drag.js +++ b/js/id/behavior/drag.js @@ -7,7 +7,7 @@ (https://github.com/mbostock/d3/issues/563) * The `start` event is not dispatched until the first cursor movement occurs. (https://github.com/mbostock/d3/pull/368) - * The `move` event has a `loc` and `dxdy` [x, y] tuple properties rather + * The `move` event has a `point` and `delta` [x, y] tuple properties rather than `x`, `y`, `dx`, and `dy` properties. * The `end` event is not dispatched if no movement occurs. * An `off` function is available that unbinds the drag's internal event handlers. @@ -85,8 +85,8 @@ iD.behavior.drag = function () { event_({ type: "move", - loc: [p[0] + offset[0], p[1] + offset[1]], - dxdy: [dx, dy] + point: [p[0] + offset[0], p[1] + offset[1]], + delta: [dx, dy] }); } diff --git a/js/id/behavior/drag_accuracy_handle.js b/js/id/behavior/drag_accuracy_handle.js index 2804739d9..5700f0d04 100644 --- a/js/id/behavior/drag_accuracy_handle.js +++ b/js/id/behavior/drag_accuracy_handle.js @@ -16,7 +16,7 @@ iD.behavior.DragAccuracyHandle = function(mode) { .on('move', function(d) { d3.event.sourceEvent.stopPropagation(); history.replace( - iD.actions.MoveNode(d.node.id, projection.invert(d3.event.loc))); + iD.actions.MoveNode(d.node.id, projection.invert(d3.event.point))); }) .on('end', function() { history.replace( diff --git a/js/id/behavior/drag_node.js b/js/id/behavior/drag_node.js index e39717be1..dbfcb3a62 100644 --- a/js/id/behavior/drag_node.js +++ b/js/id/behavior/drag_node.js @@ -14,7 +14,7 @@ iD.behavior.DragNode = function(mode) { .on('move', function(entity) { d3.event.sourceEvent.stopPropagation(); history.replace( - iD.actions.MoveNode(entity.id, projection.invert(d3.event.loc))); + iD.actions.MoveNode(entity.id, projection.invert(d3.event.point))); }) .on('end', function() { history.replace( diff --git a/js/id/behavior/drag_way.js b/js/id/behavior/drag_way.js index a8669cbe1..e0bff5caf 100644 --- a/js/id/behavior/drag_way.js +++ b/js/id/behavior/drag_way.js @@ -14,7 +14,7 @@ iD.behavior.DragWay = function(mode) { .on('move', function(entity) { d3.event.sourceEvent.stopPropagation(); history.replace( - iD.actions.MoveWay(entity.id, d3.event.dxdy, projection)); + iD.actions.MoveWay(entity.id, d3.event.delta, projection)); }) .on('end', function() { history.replace( diff --git a/test/spec/actions/move_way.js b/test/spec/actions/move_way.js index 83221e08c..38f191a3c 100644 --- a/test/spec/actions/move_way.js +++ b/test/spec/actions/move_way.js @@ -3,9 +3,9 @@ describe("iD.actions.MoveWay", function () { var node1 = iD.Node({loc: [0, 0]}), node2 = iD.Node({loc: [5, 10]}), way = iD.Way({nodes: [node1.id, node2.id]}), - dxdy = [2, 3], + delta = [2, 3], projection = d3.geo.mercator(), - graph = iD.actions.MoveWay(way.id, dxdy, projection)(iD.Graph([node1, node2, way])), + graph = iD.actions.MoveWay(way.id, delta, projection)(iD.Graph([node1, node2, way])), loc1 = graph.entity(node1.id).loc, loc2 = graph.entity(node2.id).loc; expect(loc1[0]).to.be.closeTo( 1.440, 0.001); @@ -17,9 +17,9 @@ describe("iD.actions.MoveWay", function () { it("moves repeated nodes only once", function () { var node = iD.Node({loc: [0, 0]}), way = iD.Way({nodes: [node.id, node.id]}), - dxdy = [2, 3], + delta = [2, 3], projection = d3.geo.mercator(), - graph = iD.actions.MoveWay(way.id, dxdy, projection)(iD.Graph([node, way])), + graph = iD.actions.MoveWay(way.id, delta, projection)(iD.Graph([node, way])), loc = graph.entity(node.id).loc; expect(loc[0]).to.be.closeTo( 1.440, 0.001); expect(loc[1]).to.be.closeTo(-2.159, 0.001);