mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 13:59:27 +02:00
Prevent most keyboard shortcuts during walkthrough
(If hit accidently these can really get a user stuck)
This commit is contained in:
@@ -33,6 +33,7 @@ iD.behavior.Copy = function(context) {
|
||||
|
||||
function doCopy() {
|
||||
d3.event.preventDefault();
|
||||
if (context.inIntro()) return;
|
||||
|
||||
var graph = context.graph(),
|
||||
selected = groupEntities(context.selectedIDs(), graph),
|
||||
|
||||
@@ -19,6 +19,7 @@ iD.behavior.Paste = function(context) {
|
||||
|
||||
function doPaste() {
|
||||
d3.event.preventDefault();
|
||||
if (context.inIntro()) return;
|
||||
|
||||
var mouse = context.mouse(),
|
||||
projection = context.projection,
|
||||
|
||||
@@ -147,7 +147,9 @@ iD.modes.Select = function(context, selectedIDs) {
|
||||
}
|
||||
|
||||
function ret() {
|
||||
context.enter(iD.modes.Browse(context));
|
||||
if (!context.inIntro()) {
|
||||
context.enter(iD.modes.Browse(context));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +171,7 @@ iD.modes.Select = function(context, selectedIDs) {
|
||||
operations.forEach(function(operation) {
|
||||
operation.keys.forEach(function(key) {
|
||||
keybinding.on(key, function() {
|
||||
if (!operation.disabled()) {
|
||||
if (!(context.inIntro() || operation.disabled())) {
|
||||
operation();
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ iD.ui = function(context) {
|
||||
function pan(d) {
|
||||
return function() {
|
||||
d3.event.preventDefault();
|
||||
context.pan(d);
|
||||
if (!context.inIntro()) context.pan(d);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ iD.ui.UndoRedo = function(context) {
|
||||
var commands = [{
|
||||
id: 'undo',
|
||||
cmd: iD.ui.cmd('⌘Z'),
|
||||
action: function() { if (!saving()) context.undo(); },
|
||||
action: function() { if (!(context.inIntro() || saving())) context.undo(); },
|
||||
annotation: function() { return context.history().undoAnnotation(); }
|
||||
}, {
|
||||
id: 'redo',
|
||||
cmd: iD.ui.cmd('⌘⇧Z'),
|
||||
action: function() { if (!saving()) context.redo(); },
|
||||
action: function() {if (!(context.inIntro() || saving())) context.redo(); },
|
||||
annotation: function() { return context.history().redoAnnotation(); }
|
||||
}];
|
||||
|
||||
|
||||
+4
-4
@@ -15,22 +15,22 @@ iD.ui.Zoom = function(context) {
|
||||
|
||||
function zoomIn() {
|
||||
d3.event.preventDefault();
|
||||
context.zoomIn();
|
||||
if (!context.inIntro()) context.zoomIn();
|
||||
}
|
||||
|
||||
function zoomOut() {
|
||||
d3.event.preventDefault();
|
||||
context.zoomOut();
|
||||
if (!context.inIntro()) context.zoomOut();
|
||||
}
|
||||
|
||||
function zoomInFurther() {
|
||||
d3.event.preventDefault();
|
||||
context.zoomInFurther();
|
||||
if (!context.inIntro()) context.zoomInFurther();
|
||||
}
|
||||
|
||||
function zoomOutFurther() {
|
||||
d3.event.preventDefault();
|
||||
context.zoomOutFurther();
|
||||
if (!context.inIntro()) context.zoomOutFurther();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user