From 9461fe794c129e12a6801e79ea5c15d9546327ca Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 13 Dec 2012 17:00:34 -0500 Subject: [PATCH] Fix dragging selected features. Fixes #271 --- js/id/modes/drag_features.js | 1 + js/id/modes/select.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/id/modes/drag_features.js b/js/id/modes/drag_features.js index 7a38883ed..8d2eeda18 100644 --- a/js/id/modes/drag_features.js +++ b/js/id/modes/drag_features.js @@ -4,6 +4,7 @@ iD.modes._dragFeatures = function(mode) { var dragbehavior = d3.behavior.drag() .origin(function(entity) { var p = mode.map.projection(entity.loc); + d3.event.sourceEvent.stopPropagation(); return { x: p[0], y: p[1] }; }) .on('drag', function(entity) { diff --git a/js/id/modes/select.js b/js/id/modes/select.js index daf5c9016..45eeaf8ed 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -11,8 +11,6 @@ iD.modes.Select = function (entity) { return { x: p[0], y: p[1] }; }) .on('drag', function(entity) { - if (!mode.map.dragEnable()) return; - d3.event.sourceEvent.stopPropagation(); if (!dragging) { @@ -32,7 +30,7 @@ iD.modes.Select = function (entity) { }); }) .on('dragend', function () { - if (!mode.map.dragEnable() || !dragging) return; + if (!dragging) return; dragging = undefined; mode.map.redraw(); }); @@ -53,6 +51,8 @@ iD.modes.Select = function (entity) { target = mode.map.surface.selectAll("*") .filter(function (d) { return d === entity; }); + iD.modes._dragFeatures(mode); + d3.select('.inspector-wrap') .style('display', 'block') .style('opacity', 1) @@ -99,6 +99,7 @@ iD.modes.Select = function (entity) { .on('touchstart.drag', null); } + mode.map.surface.on('mousedown.latedrag', null); mode.map.surface.on("click.browse", null); mode.map.keybinding().on('⌫.browse', null);