diff --git a/core/field.js b/core/field.js index 0ea102fff..0e919ecd3 100644 --- a/core/field.js +++ b/core/field.js @@ -433,7 +433,7 @@ Blockly.Field.prototype.onMouseUp_ = function(e) { } else if (Blockly.isRightButton(e)) { // Right-click. return; - } else if (Blockly.dragMode_ == Blockly.DRAG_FREE) { + } else if (this.sourceBlock_.workspace.isDragging()) { // Drag operation is concluding. Don't open the editor. return; } else if (this.sourceBlock_.isEditable()) { diff --git a/core/flyout.js b/core/flyout.js index e8aa2f872..c65276fea 100644 --- a/core/flyout.js +++ b/core/flyout.js @@ -761,8 +761,7 @@ Blockly.Flyout.prototype.onMouseDown_ = function(e) { * @private */ Blockly.Flyout.prototype.onMouseUp_ = function(e) { - if (Blockly.dragMode_ != Blockly.DRAG_FREE && - !Blockly.WidgetDiv.isVisible()) { + if (!this.workspace_.isDragging() && !Blockly.WidgetDiv.isVisible()) { Blockly.Events.fire( new Blockly.Events.Ui(Blockly.Flyout.startBlock_, 'click', undefined, undefined)); diff --git a/core/icon.js b/core/icon.js index 9d2cbeaad..395c98544 100644 --- a/core/icon.js +++ b/core/icon.js @@ -124,7 +124,7 @@ Blockly.Icon.prototype.isVisible = function() { * @private */ Blockly.Icon.prototype.iconClick_ = function(e) { - if (Blockly.dragMode_ == Blockly.DRAG_FREE) { + if (this.block_.workspace.isDragging()) { // Drag operation is concluding. Don't open the editor. return; } diff --git a/core/workspace_svg.js b/core/workspace_svg.js index d857bdf21..6f5f26a1b 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -710,6 +710,14 @@ Blockly.WorkspaceSvg.prototype.moveDrag = function(e) { return goog.math.Coordinate.sum(this.dragDeltaXY_, point); }; +/** + * Is the user currently dragging a block or scrolling the workspace? + * @return {boolean} True if currently dragging or scrolling + */ +Blockly.WorkspaceSvg.prototype.isDragging = function() { + return Blockly.dragMode_ == Blockly.DRAG_FREE || this.isScrolling; +}; + /** * Handle a mouse-wheel on SVG drawing surface. * @param {!Event} e Mouse wheel event.