diff --git a/core/interfaces/i_positionable.js b/core/interfaces/i_positionable.js index 89f4c8094..356510c81 100644 --- a/core/interfaces/i_positionable.js +++ b/core/interfaces/i_positionable.js @@ -37,6 +37,7 @@ Blockly.IPositionable.prototype.position; /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. - * @return {!Blockly.utils.Rect} The UI elements’s bounding box. + * @return {?Blockly.utils.Rect} The UI elements’s bounding box. Null if + * bounding box should be ignored by other UI elements. */ Blockly.IPositionable.prototype.getBoundingRectangle; diff --git a/core/trashcan.js b/core/trashcan.js index 968ee916c..f6ad48ba4 100644 --- a/core/trashcan.js +++ b/core/trashcan.js @@ -506,7 +506,8 @@ Blockly.Trashcan.prototype.position = function(metrics, savedPositions) { /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. - * @return {!Blockly.utils.Rect} The UI elements’s bounding box. + * @return {?Blockly.utils.Rect} The UI elements’s bounding box. Null if + * bounding box should be ignored by other UI elements. */ Blockly.Trashcan.prototype.getBoundingRectangle = function() { var bottom = this.top_ + this.BODY_HEIGHT_ + this.LID_HEIGHT_; diff --git a/core/workspace_svg.js b/core/workspace_svg.js index ea06193bc..95618dbef 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1148,7 +1148,10 @@ Blockly.WorkspaceSvg.prototype.resize = function() { var savedPositions = []; for (var i = 0, positionable; (positionable = positionables[i]); i++) { positionable.position(metrics, savedPositions); - savedPositions.push(positionable.getBoundingRectangle()); + var boundingRect = positionable.getBoundingRectangle(); + if (boundingRect) { + savedPositions.push(boundingRect); + } } if (this.scrollbar) { diff --git a/core/zoom_controls.js b/core/zoom_controls.js index b86111a3b..07c63e904 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -228,7 +228,8 @@ Blockly.ZoomControls.prototype.dispose = function() { /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. - * @return {!Blockly.utils.Rect} The UI elements’s bounding box. + * @return {?Blockly.utils.Rect} The UI elements’s bounding box. Null if + * bounding box should be ignored by other UI elements. */ Blockly.ZoomControls.prototype.getBoundingRectangle = function() { var height = this.SMALL_SPACING_ + 2 * this.HEIGHT_;