Migrate core/renderers/measurables/connections.js named requires

This commit is contained in:
kozbial
2021-08-16 17:13:17 -07:00
committed by Monica Kozbial
parent 974c73f0b9
commit 673c64dab8
4 changed files with 52 additions and 48 deletions

View File

@@ -13,24 +13,25 @@
goog.module('Blockly.blockRendering.Connection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Measurable');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
/* eslint-disable-next-line no-unused-vars */
const ConstantProvider = goog.requireType('Blockly.blockRendering.ConstantProvider');
const Measurable = goog.require('Blockly.blockRendering.Measurable');
/* eslint-disable-next-line no-unused-vars */
const RenderedConnection = goog.requireType('Blockly.RenderedConnection');
const Types = goog.require('Blockly.blockRendering.Types');
const object = goog.require('Blockly.utils.object');
/**
* The base class to represent a connection and the space that it takes up on
* the block.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* @param {!ConstantProvider} constants The rendering
* constants provider.
* @param {!Blockly.RenderedConnection} connectionModel The connection object on
* @param {!RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Measurable}
* @extends {Measurable}
*/
const Connection = function(constants, connectionModel) {
Connection.superClass_.constructor.call(this,
@@ -38,9 +39,9 @@ const Connection = function(constants, connectionModel) {
this.connectionModel = connectionModel;
this.shape = this.constants_.shapeFor(connectionModel);
this.isDynamicShape = !!this.shape['isDynamic'];
this.type |= Blockly.blockRendering.Types.CONNECTION;
this.type |= Types.CONNECTION;
};
Blockly.utils.object.inherits(Connection,
Blockly.blockRendering.Measurable);
object.inherits(Connection,
Measurable);
exports = Connection;

View File

@@ -13,33 +13,34 @@
goog.module('Blockly.blockRendering.NextConnection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
const Connection = goog.require('Blockly.blockRendering.Connection');
/* eslint-disable-next-line no-unused-vars */
const ConstantProvider = goog.requireType('Blockly.blockRendering.ConstantProvider');
/* eslint-disable-next-line no-unused-vars */
const RenderedConnection = goog.requireType('Blockly.RenderedConnection');
const Types = goog.require('Blockly.blockRendering.Types');
const object = goog.require('Blockly.utils.object');
/**
* An object containing information about the space a next connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* @param {!ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* @param {RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
* @extends {Connection}
*/
const NextConnection = function(constants, connectionModel) {
NextConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.NEXT_CONNECTION;
this.type |= Types.NEXT_CONNECTION;
this.height = this.shape.height;
this.width = this.shape.width;
};
Blockly.utils.object.inherits(NextConnection,
Blockly.blockRendering.Connection);
object.inherits(NextConnection,
Connection);
exports = NextConnection;

View File

@@ -14,29 +14,30 @@
goog.module('Blockly.blockRendering.OutputConnection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
const Connection = goog.require('Blockly.blockRendering.Connection');
/* eslint-disable-next-line no-unused-vars */
const ConstantProvider = goog.requireType('Blockly.blockRendering.ConstantProvider');
/* eslint-disable-next-line no-unused-vars */
const RenderedConnection = goog.requireType('Blockly.RenderedConnection');
const Types = goog.require('Blockly.blockRendering.Types');
const object = goog.require('Blockly.utils.object');
/**
* An object containing information about the space an output connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* @param {!ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* @param {RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
* @extends {Connection}
*/
const OutputConnection = function(constants, connectionModel) {
OutputConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.OUTPUT_CONNECTION;
this.type |= Types.OUTPUT_CONNECTION;
this.height = !this.isDynamicShape ? this.shape.height : 0;
this.width = !this.isDynamicShape ? this.shape.width : 0;
@@ -45,7 +46,7 @@ const OutputConnection = function(constants, connectionModel) {
this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;
this.connectionOffsetX = 0;
};
Blockly.utils.object.inherits(OutputConnection,
Blockly.blockRendering.Connection);
object.inherits(OutputConnection,
Connection);
exports = OutputConnection;

View File

@@ -13,35 +13,36 @@
goog.module('Blockly.blockRendering.PreviousConnection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
const Connection = goog.require('Blockly.blockRendering.Connection');
/* eslint-disable-next-line no-unused-vars */
const ConstantProvider = goog.requireType('Blockly.blockRendering.ConstantProvider');
/* eslint-disable-next-line no-unused-vars */
const RenderedConnection = goog.requireType('Blockly.RenderedConnection');
const Types = goog.require('Blockly.blockRendering.Types');
const object = goog.require('Blockly.utils.object');
/**
* An object containing information about the space a previous connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* @param {!ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* @param {RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
* @extends {Connection}
*/
const PreviousConnection = function(
constants, connectionModel) {
PreviousConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.PREVIOUS_CONNECTION;
this.type |= Types.PREVIOUS_CONNECTION;
this.height = this.shape.height;
this.width = this.shape.width;
};
Blockly.utils.object.inherits(PreviousConnection,
Blockly.blockRendering.Connection);
object.inherits(PreviousConnection,
Connection);
exports = PreviousConnection;