diff --git a/js/id/modes/draw_area.js b/js/id/modes/draw_area.js index 3bfe5b947..ae5925ea0 100644 --- a/js/id/modes/draw_area.js +++ b/js/id/modes/draw_area.js @@ -63,7 +63,7 @@ iD.modes.DrawArea = function(wayId) { controller.enter(iD.modes.Browse()); } - function del() { + function backspace() { d3.event.preventDefault(); history.replace( @@ -80,10 +80,27 @@ iD.modes.DrawArea = function(wayId) { } } + function del() { + d3.event.preventDefault(); + history.replace(iD.actions.DeleteWay(wayId)); + controller.enter(iD.modes.Browse()); + } + + function ret() { + d3.event.preventDefault(); + history.replace( + iD.actions.DeleteNode(node.id), + iD.actions.AddWayNode(way.id, tailId, -1), + 'added to an area'); + controller.enter(iD.modes.Browse()); + } + map.surface.on('mousemove.drawarea', mousemove); map.surface.on('click.drawarea', click); - map.keybinding().on('⎋.drawarea', esc); - map.keybinding().on('⌫.drawarea', del); + map.keybinding().on('⎋.drawarea', esc) + .on('⌫.drawarea', backspace) + .on('delete.drawarea', del) + .on('↩.drawarea', ret); }; mode.exit = function() { @@ -93,7 +110,9 @@ iD.modes.DrawArea = function(wayId) { .on('mousemove.drawarea', null) .on('click.drawarea', null); mode.map.keybinding().on('⎋.drawarea', null) - .on('⌫.drawarea', null); + .on('⌫.drawarea', null) + .on('delete.drawarea', null) + .on('↩.drawarea', null); window.setTimeout(function() { mode.map.dblclickEnable(true); }, 1000); diff --git a/js/id/modes/draw_road.js b/js/id/modes/draw_road.js index c78ff913d..463e97f76 100644 --- a/js/id/modes/draw_road.js +++ b/js/id/modes/draw_road.js @@ -81,7 +81,7 @@ iD.modes.DrawRoad = function(wayId, direction) { controller.enter(iD.modes.Browse()); } - function del() { + function backspace() { d3.event.preventDefault(); history.replace( @@ -96,8 +96,22 @@ iD.modes.DrawRoad = function(wayId, direction) { } } - map.keybinding().on('⎋.drawroad', esc); - map.keybinding().on('⌫.drawroad', del); + function del() { + d3.event.preventDefault(); + history.replace(iD.actions.DeleteWay(wayId)); + controller.enter(iD.modes.Browse()); + } + + function ret() { + d3.event.preventDefault(); + history.replace(iD.actions.DeleteNode(node.id)); + controller.enter(iD.modes.Browse()); + } + + map.keybinding().on('⎋.drawroad', esc) + .on('⌫.drawroad', backspace) + .on('delete.drawroad', del) + .on('↩.drawroad', ret); }; mode.exit = function() { @@ -108,7 +122,9 @@ iD.modes.DrawRoad = function(wayId, direction) { .on('mousemove.drawroad', null) .on('click.drawroad', null); mode.map.keybinding().on('⎋.drawroad', null) - .on('⌫.drawroad', null); + .on('⌫.drawroad', null) + .on('delete.drawroad', null) + .on('↩.drawroad', null); window.setTimeout(function() { mode.map.dblclickEnable(true); }, 1000); diff --git a/js/id/modes/select.js b/js/id/modes/select.js index fe18dba6d..8277cc46b 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -21,11 +21,14 @@ iD.modes.Select = function (entity) { mode.history.perform(iD.actions.Noop()); } - entity.nodes.forEach(function(node) { - var start = mode.map.projection(node.loc); - var end = mode.map.projection.invert([start[0] + d3.event.dx, start[1] + d3.event.dy]); - node.loc = end; - mode.history.replace(iD.actions.Move(node, end)); + _.uniq(_.pluck(entity.nodes, 'id')) + .forEach(function(id) { + var node = mode.history.graph().entity(id), + start = mode.map.projection(node.loc), + end = mode.map.projection.invert([ + start[0] + d3.event.dx, + start[1] + d3.event.dy]); + mode.history.replace(iD.actions.Move(id, end)); }); }) .on('dragend', function () { diff --git a/js/id/renderer/background.js b/js/id/renderer/background.js index 35fb4ea29..24da773d6 100644 --- a/js/id/renderer/background.js +++ b/js/id/renderer/background.js @@ -32,7 +32,7 @@ iD.Background = function() { function background() { var tiles = tile .scale(projection.scale()) - .scaleExtent(source.scaleExtent || [0, 17]) + .scaleExtent(source.scaleExtent || [1, 17]) .translate(projection.translate())(), scaleExtent = tile.scaleExtent(), z = Math.max(Math.log(projection.scale()) / Math.log(2) - 8, 0), diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index a28a81a22..b8d2668a2 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -5,7 +5,7 @@ iD.Map = function() { selection = null, hover = null, translateStart, keybinding, - projection = d3.geo.mercator(), + projection = d3.geo.mercator().scale(1024), zoom = d3.behavior.zoom() .translate(projection.translate()) .scale(projection.scale()) @@ -289,7 +289,11 @@ iD.Map = function() { function zoomPan() { if (d3.event && d3.event.sourceEvent.type === 'dblclick') { - if (!dblclickEnabled) return; + if (!dblclickEnabled) { + zoom.scale(projection.scale()) + .translate(projection.translate()); + return d3.event.sourceEvent.preventDefault(); + } } var fast = (d3.event.scale === projection.scale() && fastEnabled); projection