From fd423f4db7a5558ee30d75c657c2c2ae0e08e1d7 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 13 Feb 2013 15:39:22 -0500 Subject: [PATCH] Don't drag when shiftKey --- js/id/behavior/drag_node.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/id/behavior/drag_node.js b/js/id/behavior/drag_node.js index e06bec43e..c16ede85f 100644 --- a/js/id/behavior/drag_node.js +++ b/js/id/behavior/drag_node.js @@ -1,6 +1,7 @@ iD.behavior.DragNode = function(context) { var nudgeInterval, - wasMidpoint; + wasMidpoint, + cancelled; function edge(point, size) { var pad = [30, 100, 30, 100]; @@ -36,6 +37,9 @@ iD.behavior.DragNode = function(context) { } function start(entity) { + cancelled = d3.event.sourceEvent.shiftKey; + if (cancelled) return behavior.cancel(); + context.history() .on('undone.drag-node', cancel); @@ -74,6 +78,7 @@ iD.behavior.DragNode = function(context) { } function move(entity) { + if (cancelled) return; d3.event.sourceEvent.stopPropagation(); var nudge = edge(d3.event.point, context.map().size()); @@ -97,6 +102,7 @@ iD.behavior.DragNode = function(context) { } function end(entity) { + if (cancelled) return; off(); var d = datum();