Only add vertex when double-clicking the selected entity

Previously double-clicking would add a vertex to any way,
as long as anything was selected.
This commit is contained in:
John Firebaugh
2013-02-12 14:28:58 -08:00
parent 0dbdd7c797
commit 89fe4bff09
2 changed files with 14 additions and 9 deletions
+3 -1
View File
@@ -6,7 +6,9 @@ iD.behavior.Select = function(context) {
context.enter(iD.modes.Browse(context));
} else if (!d3.event.shiftKey) {
context.enter(iD.modes.Select(context, [datum.id]));
// Avoid re-entering Select mode with same entity.
if (context.selection().length !== 1 || context.selection()[0] !== datum.id)
context.enter(iD.modes.Select(context, [datum.id]));
} else if (context.selection().indexOf(datum.id) >= 0) {
var selection = _.without(context.selection(), datum.id);
+11 -8
View File
@@ -6,7 +6,7 @@ iD.modes.Select = function(context, selection, initial) {
var inspector = iD.ui.inspector().initial(!!initial),
keybinding = d3.keybinding('select'),
radialTime = null,
timeout = null,
behaviors = [
iD.behavior.Hover(),
iD.behavior.Select(context),
@@ -161,24 +161,27 @@ iD.modes.Select = function(context, selection, initial) {
.call(keybinding);
context.surface()
.on('dblclick.select', dblclick)
.selectAll("*")
.filter(selected)
.classed('selected', true);
radialMenu = iD.ui.RadialMenu(operations);
var showMenu = d3.event && !initial;
if (d3.event && !initial) {
if (showMenu) {
if (entity && entity.type === 'node') {
radialMenu.center(context.projection(entity.loc));
} else {
radialMenu.center(d3.mouse(context.surface().node()));
}
radialTime = window.setTimeout(function() {
context.surface().call(radialMenu);
}, 300);
}
timeout = window.setTimeout(function() {
if (showMenu) context.surface().call(radialMenu);
context.surface()
.on('dblclick.select', dblclick)
}, 300);
};
mode.exit = function() {
@@ -186,7 +189,7 @@ iD.modes.Select = function(context, selection, initial) {
changeTags(singular(), inspector.tags());
}
if (radialTime) window.clearTimeout(radialTime);
if (timeout) window.clearTimeout(timeout);
context.container()
.select('.inspector-wrap')