Prevent most keyboard shortcuts during walkthrough

(If hit accidently these can really get a user stuck)
This commit is contained in:
Bryan Housel
2015-12-22 23:06:41 -05:00
parent a2f32275ac
commit afca7c5643
6 changed files with 13 additions and 9 deletions
+1
View File
@@ -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),
+1
View File
@@ -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,
+4 -2
View File
@@ -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
View File
@@ -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 -2
View File
@@ -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
View File
@@ -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();
}