Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update positionable jsdoc #4908

Merged
merged 3 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/interfaces/i_positionable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 2 additions & 1 deletion core/trashcan.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
5 changes: 4 additions & 1 deletion core/workspace_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion core/zoom_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down