mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
No keyboard access to quarks during drag.
Same issue as zooming with the mouse wheel.
This commit is contained in:
@@ -211,7 +211,7 @@ Blockly.onKeyDown_ = function(e) {
|
||||
// data loss.
|
||||
e.preventDefault();
|
||||
// Don't delete while dragging. Jeez.
|
||||
if (workspace.isDragging()) {
|
||||
if (Blockly.Gesture.inProgress()) {
|
||||
return;
|
||||
}
|
||||
if (Blockly.selected && Blockly.selected.isDeletable()) {
|
||||
@@ -219,7 +219,7 @@ Blockly.onKeyDown_ = function(e) {
|
||||
}
|
||||
} else if (e.altKey || e.ctrlKey || e.metaKey) {
|
||||
// Don't use meta keys during drags.
|
||||
if (workspace.isDragging()) {
|
||||
if (Blockly.Gesture.inProgress()) {
|
||||
return;
|
||||
}
|
||||
if (Blockly.selected &&
|
||||
|
||||
@@ -954,3 +954,18 @@ Blockly.Gesture.prototype.getInsertionMarkers = function() {
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Is a drag or other gesture currently in progress on any workspace?
|
||||
* @return {boolean} True if gesture is occurring.
|
||||
*/
|
||||
Blockly.Gesture.inProgress = function() {
|
||||
// If a drag is occurring, then it involves a selected block on a workspace.
|
||||
if (Blockly.selected) {
|
||||
var currentWorkspace = Blockly.selected.workspace;
|
||||
if (currentWorkspace && currentWorkspace.currentGesture_) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -1302,14 +1302,10 @@ Blockly.WorkspaceSvg.prototype.isMovable = function() {
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) {
|
||||
// Don't scroll or zoom anything if drag is in progress.
|
||||
// If a drag is occurring, then it involves a selected block on a workspace.
|
||||
if (Blockly.selected) {
|
||||
var currentWorkspace = Blockly.selected.workspace;
|
||||
if (currentWorkspace && currentWorkspace.currentGesture_) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (Blockly.Gesture.inProgress()) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
var canWheelZoom = this.options.zoomOptions && this.options.zoomOptions.wheel;
|
||||
var canWheelMove = this.options.moveOptions && this.options.moveOptions.wheel;
|
||||
|
||||
Reference in New Issue
Block a user