diff --git a/index.html b/index.html index a08ea9423..9c633bc18 100644 --- a/index.html +++ b/index.html @@ -132,7 +132,7 @@ - + diff --git a/js/id/modes/move_way.js b/js/id/modes/move.js similarity index 59% rename from js/id/modes/move_way.js rename to js/id/modes/move.js index 84f9e819f..d6bdde104 100644 --- a/js/id/modes/move_way.js +++ b/js/id/modes/move.js @@ -1,15 +1,18 @@ -iD.modes.MoveWay = function(context, wayId) { +iD.modes.Move = function(context, entityIDs) { var mode = { - id: 'move-way', + id: 'move', button: 'browse' }; - var keybinding = d3.keybinding('move-way'); + var keybinding = d3.keybinding('move'), + entities = entityIDs.map(context.entity); mode.enter = function() { var origin, nudgeInterval, - annotation = t('operations.move.annotation.' + context.geometry(wayId)); + annotation = entities.length === 1 ? + t('operations.move.annotation.' + context.geometry(entities[0].id)) : + t('operations.move.annotation.multiple'); context.perform( iD.actions.Noop(), @@ -54,19 +57,29 @@ iD.modes.MoveWay = function(context, wayId) { origin = context.map().mouseCoordinates(); - context.replace( - iD.actions.MoveWay(wayId, delta, context.projection), - annotation); + entities.forEach(function(entity) { + if (entity.type === 'way') { + context.replace( + iD.actions.MoveWay(entity.id, delta, context.projection)); + } else if (entity.type === 'node') { + var start = context.projection(context.entity(entity.id).loc), + end = [start[0] + delta[0], start[1] + delta[1]], + loc = context.projection.invert(end); + context.replace(iD.actions.MoveNode(entity.id, loc)); + } + }); + + context.replace(iD.actions.Noop(), annotation); } function finish() { d3.event.stopPropagation(); - context.enter(iD.modes.Select(context, [wayId], true)); + context.enter(iD.modes.Select(context, entityIDs, true)); } function cancel() { context.pop(); - context.enter(iD.modes.Select(context, [wayId], true)); + context.enter(iD.modes.Select(context, entityIDs, true)); } function undone() { @@ -74,11 +87,11 @@ iD.modes.MoveWay = function(context, wayId) { } context.surface() - .on('mousemove.move-way', move) - .on('click.move-way', finish); + .on('mousemove.move', move) + .on('click.move', finish); context.history() - .on('undone.move-way', undone); + .on('undone.move', undone); keybinding .on('⎋', cancel) @@ -90,11 +103,11 @@ iD.modes.MoveWay = function(context, wayId) { mode.exit = function() { context.surface() - .on('mousemove.move-way', null) - .on('click.move-way', null); + .on('mousemove.move', null) + .on('click.move', null); context.history() - .on('undone.move-way', null); + .on('undone.move', null); keybinding.off(); }; diff --git a/js/id/operations/move.js b/js/id/operations/move.js index d9da39f64..dd001be8d 100644 --- a/js/id/operations/move.js +++ b/js/id/operations/move.js @@ -1,13 +1,12 @@ iD.operations.Move = function(selection, context) { - var entityId = selection[0]; var operation = function() { - context.enter(iD.modes.MoveWay(context, entityId)); + context.enter(iD.modes.Move(context, selection)); }; operation.available = function() { - return selection.length === 1 && - context.entity(entityId).type === 'way'; + return selection.length > 1 || + context.entity(selection[0]).type === 'way'; }; operation.enabled = function() { diff --git a/locale/en.js b/locale/en.js index 99796939f..17b58275e 100644 --- a/locale/en.js +++ b/locale/en.js @@ -111,7 +111,8 @@ locale.en = { point: "Moved a point.", vertex: "Moved a node in a way.", line: "Moved a line.", - area: "Moved an area." + area: "Moved an area.", + multiple: "Moved multiple objects" } }, reverse: { @@ -221,7 +222,7 @@ locale.en = { }, zoom: { - in: "Zoom In", + 'in': "Zoom In", out: "Zoom Out" } }; diff --git a/test/index.html b/test/index.html index f42498ec5..603f29a08 100644 --- a/test/index.html +++ b/test/index.html @@ -119,7 +119,7 @@ - +