Make drag detection more robust.

Previously, one could drag (and hold) a quark outside the bounds of a mutator bubble, then scroll, and the old code wouldn’t query the mutator for gestures.
This commit is contained in:
Neil Fraser
2019-03-28 14:48:01 -07:00
committed by Neil Fraser
parent 46a4f33e4e
commit 87385b0721

View File

@@ -1305,10 +1305,14 @@ Blockly.WorkspaceSvg.prototype.isMovable = function() {
*/
Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) {
// Don't scroll or zoom anything if drag is in progress.
if (this.currentGesture_) {
e.preventDefault();
e.stopPropagation();
return;
// 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;
}
}
var canWheelZoom = this.options.zoomOptions && this.options.zoomOptions.wheel;
var canWheelMove = this.options.moveOptions && this.options.moveOptions.wheel;