mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 09:42:56 +00:00
Reopen radial menu when clicking on selected entity (fixes #758)
This commit is contained in:
@@ -8,9 +8,11 @@ iD.behavior.Select = function(context) {
|
||||
|
||||
} else if (!d3.event.shiftKey) {
|
||||
// Avoid re-entering Select mode with same entity.
|
||||
if (context.selection().length !== 1 || context.selection()[0] !== datum.id)
|
||||
if (context.selection().length !== 1 || context.selection()[0] !== datum.id) {
|
||||
context.enter(iD.modes.Select(context, [datum.id]));
|
||||
|
||||
} else {
|
||||
context.mode().reselect();
|
||||
}
|
||||
} else if (context.selection().indexOf(datum.id) >= 0) {
|
||||
var selection = _.without(context.selection(), datum.id);
|
||||
context.enter(selection.length ?
|
||||
|
||||
@@ -28,10 +28,31 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
}
|
||||
}
|
||||
|
||||
function positionMenu() {
|
||||
var entity = singular();
|
||||
|
||||
if (entity && entity.type === 'node') {
|
||||
radialMenu.center(context.projection(entity.loc));
|
||||
} else {
|
||||
radialMenu.center(d3.mouse(context.surface().node()));
|
||||
}
|
||||
}
|
||||
|
||||
function showMenu() {
|
||||
context.surface()
|
||||
.call(radialMenu.close)
|
||||
.call(radialMenu);
|
||||
}
|
||||
|
||||
mode.selection = function() {
|
||||
return selection;
|
||||
};
|
||||
|
||||
mode.reselect = function() {
|
||||
positionMenu();
|
||||
showMenu();
|
||||
};
|
||||
|
||||
mode.enter = function() {
|
||||
var entity = singular();
|
||||
|
||||
@@ -166,18 +187,16 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
.classed('selected', true);
|
||||
|
||||
radialMenu = iD.ui.RadialMenu(operations);
|
||||
var showMenu = d3.event && !initial;
|
||||
var show = d3.event && !initial;
|
||||
|
||||
if (showMenu) {
|
||||
if (entity && entity.type === 'node') {
|
||||
radialMenu.center(context.projection(entity.loc));
|
||||
} else {
|
||||
radialMenu.center(d3.mouse(context.surface().node()));
|
||||
}
|
||||
if (show) {
|
||||
positionMenu();
|
||||
}
|
||||
|
||||
timeout = window.setTimeout(function() {
|
||||
if (showMenu) context.surface().call(radialMenu);
|
||||
if (show) {
|
||||
showMenu();
|
||||
}
|
||||
|
||||
context.surface()
|
||||
.on('dblclick.select', dblclick);
|
||||
|
||||
Reference in New Issue
Block a user