From 87385b07211ec1ec853ed28595659a9d6c812a8e Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Thu, 28 Mar 2019 14:48:01 -0700 Subject: [PATCH] Make drag detection more robust. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- core/workspace_svg.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/workspace_svg.js b/core/workspace_svg.js index ee1be8f36..4ec9b0e44 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -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;