Rename bounding box to bounded element (#3909)

This commit is contained in:
Sam El-Husseini
2020-05-20 11:21:26 -07:00
committed by GitHub
parent fd916fdb9b
commit 6809f63555
4 changed files with 33 additions and 33 deletions

View File

@@ -32,7 +32,7 @@ goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Rect');
goog.requireType('Blockly.IBoundingBox');
goog.requireType('Blockly.IBoundedElement');
goog.requireType('Blockly.ICopyable');
/**
@@ -44,7 +44,7 @@ goog.requireType('Blockly.ICopyable');
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
* create a new ID.
* @extends {Blockly.Block}
* @implements {Blockly.IBoundingBox}
* @implements {Blockly.IBoundedElement}
* @implements {Blockly.ICopyable}
* @constructor
*/

View File

@@ -5,27 +5,27 @@
*/
/**
* @fileoverview The interface for a bounding box.
* @fileoverview The interface for a bounded element.
* @author samelh@google.com (Sam El-Husseini)
*/
'use strict';
goog.provide('Blockly.IBoundingBox');
goog.provide('Blockly.IBoundedElement');
goog.requireType('Blockly.utils.Rect');
/**
* A bounding box interface.
* A bounded element interface.
* @interface
*/
Blockly.IBoundingBox = function() {};
Blockly.IBoundedElement = function() {};
/**
* Returns the coordinates of a bounding box describing the dimensions of this
* Returns the coordinates of a bounded element describing the dimensions of the
* element.
* Coordinate system: workspace coordinates.
* @return {!Blockly.utils.Rect} Object with coordinates of the bounding box.
* @return {!Blockly.utils.Rect} Object with coordinates of the bounded element.
*/
Blockly.IBoundingBox.prototype.getBoundingRectangle;
Blockly.IBoundedElement.prototype.getBoundingRectangle;

View File

@@ -25,7 +25,7 @@ goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Rect');
goog.require('Blockly.WorkspaceComment');
goog.requireType('Blockly.IBoundingBox');
goog.requireType('Blockly.IBoundedElement');
goog.requireType('Blockly.ICopyable');
/**
@@ -37,7 +37,7 @@ goog.requireType('Blockly.ICopyable');
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
* create a new ID.
* @extends {Blockly.WorkspaceComment}
* @implements {Blockly.IBoundingBox}
* @implements {Blockly.IBoundedElement}
* @implements {Blockly.ICopyable}
* @constructor
*/

View File

@@ -39,7 +39,7 @@ goog.require('Blockly.WorkspaceDragSurfaceSvg');
goog.require('Blockly.Xml');
goog.requireType('Blockly.blockRendering.Renderer');
goog.requireType('Blockly.IBoundingBox');
goog.requireType('Blockly.IBoundedElement');
/**
@@ -170,11 +170,11 @@ Blockly.WorkspaceSvg = function(options,
this.keyboardAccessibilityMode = false;
/**
* The list of top-level bounding boxes on the workspace.
* @type {!Array.<!Blockly.IBoundingBox>}
* The list of top-level bounded elements on the workspace.
* @type {!Array.<!Blockly.IBoundedElement>}
* @private
*/
this.topBoundingBoxes_ = [];
this.topBoundedElements_ = [];
};
Blockly.utils.object.inherits(Blockly.WorkspaceSvg, Blockly.Workspace);
@@ -1621,7 +1621,7 @@ Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) {
* bounding box containing the blocks on the workspace.
*/
Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox = function() {
var topElements = this.getTopBoundingBoxes();
var topElements = this.getTopBoundedElements();
// There are no blocks, return empty rectangle.
if (!topElements.length) {
return new Blockly.utils.Rect(0, 0, 0, 0);
@@ -2497,7 +2497,7 @@ Blockly.WorkspaceSvg.prototype.getTopBlocks = function(ordered) {
* @param {!Blockly.Block} block Block to add.
*/
Blockly.WorkspaceSvg.prototype.addTopBlock = function(block) {
this.addTopBoundingBox(/** @type {!Blockly.BlockSvg} */ (block));
this.addTopBoundedElement(/** @type {!Blockly.BlockSvg} */ (block));
Blockly.WorkspaceSvg.superClass_.addTopBlock.call(this, block);
};
@@ -2506,7 +2506,7 @@ Blockly.WorkspaceSvg.prototype.addTopBlock = function(block) {
* @param {!Blockly.Block} block Block to remove.
*/
Blockly.WorkspaceSvg.prototype.removeTopBlock = function(block) {
this.removeTopBoundingBox(/** @type {!Blockly.BlockSvg} */ (block));
this.removeTopBoundedElement(/** @type {!Blockly.BlockSvg} */ (block));
Blockly.WorkspaceSvg.superClass_.removeTopBlock.call(this, block);
};
@@ -2515,7 +2515,7 @@ Blockly.WorkspaceSvg.prototype.removeTopBlock = function(block) {
* @param {!Blockly.WorkspaceComment} comment comment to add.
*/
Blockly.WorkspaceSvg.prototype.addTopComment = function(comment) {
this.addTopBoundingBox(
this.addTopBoundedElement(
/** @type {!Blockly.WorkspaceCommentSvg} */ (comment));
Blockly.WorkspaceSvg.superClass_.addTopComment.call(this, comment);
};
@@ -2525,33 +2525,33 @@ Blockly.WorkspaceSvg.prototype.addTopComment = function(comment) {
* @param {!Blockly.WorkspaceComment} comment comment to remove.
*/
Blockly.WorkspaceSvg.prototype.removeTopComment = function(comment) {
this.removeTopBoundingBox(
this.removeTopBoundedElement(
/** @type {!Blockly.WorkspaceCommentSvg} */ (comment));
Blockly.WorkspaceSvg.superClass_.removeTopComment.call(this, comment);
};
/**
* Adds a bounding box to the list of top bounding boxes.
* @param {!Blockly.IBoundingBox} element Bounding box to add.
* Adds a bounded element to the list of top bounded elements.
* @param {!Blockly.IBoundedElement} element Bounded element to add.
*/
Blockly.WorkspaceSvg.prototype.addTopBoundingBox = function(element) {
this.topBoundingBoxes_.push(element);
Blockly.WorkspaceSvg.prototype.addTopBoundedElement = function(element) {
this.topBoundedElements_.push(element);
};
/**
* Removes a bounding box from the list of top bounding boxes.
* @param {!Blockly.IBoundingBox} element Bounding box to remove.
* Removes a bounded element from the list of top bounded elements.
* @param {!Blockly.IBoundedElement} element Bounded element to remove.
*/
Blockly.WorkspaceSvg.prototype.removeTopBoundingBox = function(element) {
Blockly.utils.arrayRemove(this.topBoundingBoxes_, element);
Blockly.WorkspaceSvg.prototype.removeTopBoundedElement = function(element) {
Blockly.utils.arrayRemove(this.topBoundedElements_, element);
};
/**
* Finds the top-level bounding box and returns them.
* @return {!Array.<!Blockly.IBoundingBox>} The top-level bounding boxes.
* Finds the top-level bounded elements and returns them.
* @return {!Array.<!Blockly.IBoundedElement>} The top-level bounded elements.
*/
Blockly.WorkspaceSvg.prototype.getTopBoundingBoxes = function() {
return [].concat(this.topBoundingBoxes_);
Blockly.WorkspaceSvg.prototype.getTopBoundedElements = function() {
return [].concat(this.topBoundedElements_);
};
/**
@@ -2576,7 +2576,7 @@ Blockly.WorkspaceSvg.prototype.setResizesEnabled = function(enabled) {
Blockly.WorkspaceSvg.prototype.clear = function() {
this.setResizesEnabled(false);
Blockly.WorkspaceSvg.superClass_.clear.call(this);
this.topBoundingBoxes_ = [];
this.topBoundedElements_ = [];
this.setResizesEnabled(true);
};