Allow escape to cancel paste

(closes #2889)
This commit is contained in:
Bryan Housel
2016-02-07 00:46:12 -05:00
parent 540700c6ef
commit 36a767554c
2 changed files with 11 additions and 5 deletions
+3 -2
View File
@@ -21,7 +21,8 @@ iD.behavior.Paste = function(context) {
d3.event.preventDefault();
if (context.inIntro()) return;
var mouse = context.mouse(),
var baseGraph = context.graph(),
mouse = context.mouse(),
projection = context.projection,
viewport = iD.geo.Extent(projection.clipExtent()).polygon();
@@ -61,7 +62,7 @@ iD.behavior.Paste = function(context) {
delta = [ mouse[0] - center[0], mouse[1] - center[1] ];
context.perform(iD.actions.Move(newIDs, delta, projection));
context.enter(iD.modes.Move(context, newIDs));
context.enter(iD.modes.Move(context, newIDs, baseGraph));
}
function paste() {
+8 -3
View File
@@ -1,4 +1,4 @@
iD.modes.Move = function(context, entityIDs) {
iD.modes.Move = function(context, entityIDs, baseGraph) {
var mode = {
id: 'move',
button: 'browse'
@@ -64,8 +64,13 @@ iD.modes.Move = function(context, entityIDs) {
}
function cancel() {
context.pop();
context.enter(iD.modes.Select(context, entityIDs).suppressMenu(true));
if (baseGraph) {
while (context.graph() !== baseGraph) context.pop();
context.enter(iD.modes.Browse(context));
} else {
context.pop();
context.enter(iD.modes.Select(context, entityIDs).suppressMenu(true));
}
stopNudge();
}