mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
fix: Add missing require for Blockly.utils.object, .Size (#5427)
Some files were using Blockly.utils.object.inherits (or .mixin) without having imported Blockly.utils.object. Similarly, trashcan.js tried to use utils.Size as a constructor instead of importing Size from Blockly.utils.Size.
This commit is contained in:
committed by
GitHub
parent
24d73be1c3
commit
c31895dc60
@@ -37,6 +37,7 @@ const WorkspaceSvg = goog.require('Blockly.WorkspaceSvg');
|
||||
const Xml = goog.require('Blockly.Xml');
|
||||
const browserEvents = goog.require('Blockly.browserEvents');
|
||||
const dom = goog.require('Blockly.utils.dom');
|
||||
const object = goog.require('Blockly.utils.object');
|
||||
const toolbox = goog.require('Blockly.utils.toolbox');
|
||||
const utils = goog.require('Blockly.utils');
|
||||
const utilsXml = goog.require('Blockly.utils.xml');
|
||||
@@ -155,7 +156,7 @@ const Flyout = function(workspaceOptions) {
|
||||
*/
|
||||
this.targetWorkspace = null;
|
||||
};
|
||||
utils.object.inherits(Flyout, DeleteArea);
|
||||
object.inherits(Flyout, DeleteArea);
|
||||
|
||||
/**
|
||||
* Does the flyout automatically close when a block is created?
|
||||
|
||||
@@ -21,6 +21,7 @@ const Theme = goog.requireType('Blockly.Theme');
|
||||
const colour = goog.require('Blockly.utils.colour');
|
||||
const connectionTypes = goog.require('Blockly.connectionTypes');
|
||||
const dom = goog.require('Blockly.utils.dom');
|
||||
const object = goog.require('Blockly.utils.object');
|
||||
const svgPaths = goog.require('Blockly.utils.svgPaths');
|
||||
const userAgent = goog.require('Blockly.utils.userAgent');
|
||||
const utils = goog.require('Blockly.utils');
|
||||
@@ -715,7 +716,7 @@ ConstantProvider.prototype.validatedBlockStyle_ = function(blockStyle) {
|
||||
// Make a new object with all of the same properties.
|
||||
const valid = /** @type {!Theme.BlockStyle} */ ({});
|
||||
if (blockStyle) {
|
||||
utils.object.mixin(valid, blockStyle);
|
||||
object.mixin(valid, blockStyle);
|
||||
}
|
||||
// Validate required properties.
|
||||
const parsedColour = utils.parseBlockColour(valid['colourPrimary'] || '#000');
|
||||
|
||||
@@ -50,6 +50,7 @@ const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
|
||||
const aria = goog.require('Blockly.utils.aria');
|
||||
const browserEvents = goog.require('Blockly.browserEvents');
|
||||
const dom = goog.require('Blockly.utils.dom');
|
||||
const object = goog.require('Blockly.utils.object');
|
||||
const registry = goog.require('Blockly.registry');
|
||||
const utils = goog.require('Blockly.utils');
|
||||
const toolbox = goog.require('Blockly.utils.toolbox');
|
||||
@@ -189,7 +190,7 @@ const Toolbox = function(workspace) {
|
||||
*/
|
||||
this.boundEvents_ = [];
|
||||
};
|
||||
utils.object.inherits(Toolbox, DeleteArea);
|
||||
object.inherits(Toolbox, DeleteArea);
|
||||
|
||||
/**
|
||||
* Handles the given keyboard shortcut.
|
||||
|
||||
@@ -32,6 +32,7 @@ const IPositionable = goog.requireType('Blockly.IPositionable');
|
||||
const MetricsManager = goog.requireType('Blockly.MetricsManager');
|
||||
const Options = goog.require('Blockly.Options');
|
||||
const Rect = goog.require('Blockly.utils.Rect');
|
||||
const Size = goog.require('Blockly.utils.Size');
|
||||
const Svg = goog.require('Blockly.utils.Svg');
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
|
||||
@@ -39,10 +40,10 @@ const Xml = goog.require('Blockly.Xml');
|
||||
const browserEvents = goog.require('Blockly.browserEvents');
|
||||
const dom = goog.require('Blockly.utils.dom');
|
||||
const internalConstants = goog.require('Blockly.internalConstants');
|
||||
const object = goog.require('Blockly.utils.object');
|
||||
const registry = goog.require('Blockly.registry');
|
||||
const toolbox = goog.require('Blockly.utils.toolbox');
|
||||
const uiPosition = goog.require('Blockly.uiPosition');
|
||||
const utils = goog.require('Blockly.utils');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.Events.TrashcanOpen');
|
||||
|
||||
@@ -123,7 +124,7 @@ const Trashcan = function(workspace) {
|
||||
}
|
||||
this.workspace_.addChangeListener(this.onDelete_.bind(this));
|
||||
};
|
||||
utils.object.inherits(Trashcan, DeleteArea);
|
||||
object.inherits(Trashcan, DeleteArea);
|
||||
|
||||
/**
|
||||
* Width of both the trash can and lid images.
|
||||
@@ -453,7 +454,7 @@ Trashcan.prototype.position = function(metrics, savedPositions) {
|
||||
|
||||
const height = BODY_HEIGHT + LID_HEIGHT;
|
||||
const startRect = uiPosition.getStartPositionRect(
|
||||
cornerPosition, new utils.Size(WIDTH, height), MARGIN_HORIZONTAL,
|
||||
cornerPosition, new Size(WIDTH, height), MARGIN_HORIZONTAL,
|
||||
MARGIN_VERTICAL, metrics, this.workspace_);
|
||||
|
||||
const verticalPosition = cornerPosition.vertical;
|
||||
|
||||
@@ -19,6 +19,7 @@ const Events = goog.require('Blockly.Events');
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
const IPositionable = goog.requireType('Blockly.IPositionable');
|
||||
const Rect = goog.require('Blockly.utils.Rect');
|
||||
const Size = goog.require('Blockly.utils.Size');
|
||||
const Svg = goog.require('Blockly.utils.Svg');
|
||||
const Touch = goog.require('Blockly.Touch');
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
@@ -27,7 +28,6 @@ const browserEvents = goog.require('Blockly.browserEvents');
|
||||
const dom = goog.require('Blockly.utils.dom');
|
||||
const internalConstants = goog.require('Blockly.internalConstants');
|
||||
const uiPosition = goog.require('Blockly.uiPosition');
|
||||
const utils = goog.require('Blockly.utils');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.Events.Click');
|
||||
|
||||
@@ -264,7 +264,7 @@ ZoomControls.prototype.position = function(metrics, savedPositions) {
|
||||
height += this.LARGE_SPACING_ + this.HEIGHT_;
|
||||
}
|
||||
const startRect = uiPosition.getStartPositionRect(
|
||||
cornerPosition, new utils.Size(this.WIDTH_, height),
|
||||
cornerPosition, new Size(this.WIDTH_, height),
|
||||
this.MARGIN_HORIZONTAL_, this.MARGIN_VERTICAL_, metrics, this.workspace_);
|
||||
|
||||
const verticalPosition = cornerPosition.vertical;
|
||||
|
||||
Reference in New Issue
Block a user