From dbafdcf1ff2844f82ea9094e624d5f20a694ac58 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Wed, 27 Mar 2019 15:24:39 -0700 Subject: [PATCH] Prevent gestures from being broken by zoom/scroll. --- core/workspace_svg.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/workspace_svg.js b/core/workspace_svg.js index f4ed5eb46..d62f720f7 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1304,19 +1304,18 @@ Blockly.WorkspaceSvg.prototype.isMovable = function() { * @private */ 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; + } var canWheelZoom = this.options.zoomOptions && this.options.zoomOptions.wheel; var canWheelMove = this.options.moveOptions && this.options.moveOptions.wheel; if (!canWheelZoom && !canWheelMove) { return; } - // TODO: Remove gesture cancellation and compensate for coordinate skew during - // zoom. - if (this.currentGesture_) { - this.currentGesture_.cancel(); - } - - var scrollDelta = Blockly.utils.getScrollDeltaPixels(e); if (canWheelZoom && (e.ctrlKey || !canWheelMove)) { // The vertical scroll distance that corresponds to a click of a zoom button.