Prevent gestures from being broken by zoom/scroll.

This commit is contained in:
Neil Fraser
2019-03-27 15:24:39 -07:00
committed by Neil Fraser
parent c566c2e712
commit dbafdcf1ff

View File

@@ -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.