Migrate core/renderers/measurables/connections.js to goog.module

This commit is contained in:
kozbial
2021-08-16 17:07:40 -07:00
committed by Monica Kozbial
parent d50247664a
commit 974c73f0b9
5 changed files with 32 additions and 20 deletions

View File

@@ -10,7 +10,8 @@
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.Connection');
goog.module('Blockly.blockRendering.Connection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Measurable');
goog.require('Blockly.blockRendering.Types');
@@ -31,13 +32,15 @@ goog.requireType('Blockly.RenderedConnection');
* @constructor
* @extends {Blockly.blockRendering.Measurable}
*/
Blockly.blockRendering.Connection = function(constants, connectionModel) {
Blockly.blockRendering.Connection.superClass_.constructor.call(this,
const Connection = function(constants, connectionModel) {
Connection.superClass_.constructor.call(this,
constants);
this.connectionModel = connectionModel;
this.shape = this.constants_.shapeFor(connectionModel);
this.isDynamicShape = !!this.shape['isDynamic'];
this.type |= Blockly.blockRendering.Types.CONNECTION;
};
Blockly.utils.object.inherits(Blockly.blockRendering.Connection,
Blockly.utils.object.inherits(Connection,
Blockly.blockRendering.Measurable);
exports = Connection;

View File

@@ -10,7 +10,8 @@
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.NextConnection');
goog.module('Blockly.blockRendering.NextConnection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
@@ -31,12 +32,14 @@ goog.requireType('Blockly.RenderedConnection');
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.NextConnection = function(constants, connectionModel) {
Blockly.blockRendering.NextConnection.superClass_.constructor.call(this,
const NextConnection = function(constants, connectionModel) {
NextConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.NEXT_CONNECTION;
this.height = this.shape.height;
this.width = this.shape.width;
};
Blockly.utils.object.inherits(Blockly.blockRendering.NextConnection,
Blockly.utils.object.inherits(NextConnection,
Blockly.blockRendering.Connection);
exports = NextConnection;

View File

@@ -11,7 +11,8 @@
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.OutputConnection');
goog.module('Blockly.blockRendering.OutputConnection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
@@ -32,8 +33,8 @@ goog.requireType('Blockly.RenderedConnection');
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.OutputConnection = function(constants, connectionModel) {
Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,
const OutputConnection = function(constants, connectionModel) {
OutputConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.OUTPUT_CONNECTION;
@@ -44,5 +45,7 @@ Blockly.blockRendering.OutputConnection = function(constants, connectionModel) {
this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;
this.connectionOffsetX = 0;
};
Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,
Blockly.utils.object.inherits(OutputConnection,
Blockly.blockRendering.Connection);
exports = OutputConnection;

View File

@@ -10,7 +10,8 @@
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.PreviousConnection');
goog.module('Blockly.blockRendering.PreviousConnection');
goog.module.declareLegacyNamespace();
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
@@ -31,14 +32,16 @@ goog.requireType('Blockly.RenderedConnection');
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.PreviousConnection = function(
const PreviousConnection = function(
constants, connectionModel) {
Blockly.blockRendering.PreviousConnection.superClass_.constructor.call(this,
PreviousConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.PREVIOUS_CONNECTION;
this.height = this.shape.height;
this.width = this.shape.width;
};
Blockly.utils.object.inherits(Blockly.blockRendering.PreviousConnection,
Blockly.utils.object.inherits(PreviousConnection,
Blockly.blockRendering.Connection);
exports = PreviousConnection;