Split classes from core/renderers/measurables/connections.js into multiple files

This commit is contained in:
kozbial
2021-08-16 17:06:14 -07:00
committed by Monica Kozbial
parent e75a50b8b9
commit d50247664a
6 changed files with 181 additions and 117 deletions

View File

@@ -0,0 +1,43 @@
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Base class representing the space a connection takes up during
* rendering.
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Measurable');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
/**
* The base class to represent a connection and the space that it takes up on
* the block.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {!Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Measurable}
*/
Blockly.blockRendering.Connection = function(constants, connectionModel) {
Blockly.blockRendering.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.blockRendering.Measurable);

View File

@@ -1,116 +0,0 @@
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Objects representing connections on rendered blocks.
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.Connection');
goog.provide('Blockly.blockRendering.NextConnection');
goog.provide('Blockly.blockRendering.OutputConnection');
goog.provide('Blockly.blockRendering.PreviousConnection');
goog.require('Blockly.blockRendering.Measurable');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
/**
* The base class to represent a connection and the space that it takes up on
* the block.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {!Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Measurable}
*/
Blockly.blockRendering.Connection = function(constants, connectionModel) {
Blockly.blockRendering.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.blockRendering.Measurable);
/**
* An object containing information about the space an output connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.OutputConnection = function(constants, connectionModel) {
Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.OUTPUT_CONNECTION;
this.height = !this.isDynamicShape ? this.shape.height : 0;
this.width = !this.isDynamicShape ? this.shape.width : 0;
this.startX = this.width;
this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;
this.connectionOffsetX = 0;
};
Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,
Blockly.blockRendering.Connection);
/**
* An object containing information about the space a previous connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.PreviousConnection = function(
constants, connectionModel) {
Blockly.blockRendering.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.blockRendering.Connection);
/**
* An object containing information about the space a next connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.NextConnection = function(constants, connectionModel) {
Blockly.blockRendering.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.blockRendering.Connection);

View File

@@ -0,0 +1,42 @@
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Class representing the space a next connection takes up during
* rendering.
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.NextConnection');
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
/**
* An object containing information about the space a next connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.NextConnection = function(constants, connectionModel) {
Blockly.blockRendering.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.blockRendering.Connection);

View File

@@ -0,0 +1,48 @@
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Class representing the space a output connection takes up
* during rendering.
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.OutputConnection');
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
/**
* An object containing information about the space an output connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.OutputConnection = function(constants, connectionModel) {
Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,
constants, connectionModel);
this.type |= Blockly.blockRendering.Types.OUTPUT_CONNECTION;
this.height = !this.isDynamicShape ? this.shape.height : 0;
this.width = !this.isDynamicShape ? this.shape.width : 0;
this.startX = this.width;
this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;
this.connectionOffsetX = 0;
};
Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,
Blockly.blockRendering.Connection);

View File

@@ -0,0 +1,44 @@
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Class representing the space a previous connection takes up
* during rendering.
* @author fenichel@google.com (Rachel Fenichel)
*/
goog.provide('Blockly.blockRendering.PreviousConnection');
goog.require('Blockly.blockRendering.Connection');
goog.require('Blockly.blockRendering.Types');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.blockRendering.ConstantProvider');
goog.requireType('Blockly.RenderedConnection');
/**
* An object containing information about the space a previous connection takes
* up during rendering.
* @param {!Blockly.blockRendering.ConstantProvider} constants The rendering
* constants provider.
* @param {Blockly.RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Blockly.blockRendering.Connection}
*/
Blockly.blockRendering.PreviousConnection = function(
constants, connectionModel) {
Blockly.blockRendering.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.blockRendering.Connection);

View File

@@ -150,7 +150,7 @@ goog.addDependency('../../core/renderers/geras/path_object.js', ['Blockly.geras.
goog.addDependency('../../core/renderers/geras/renderer.js', ['Blockly.geras.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.geras.ConstantProvider', 'Blockly.geras.Drawer', 'Blockly.geras.HighlightConstantProvider', 'Blockly.geras.PathObject', 'Blockly.geras.RenderInfo', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/base.js', ['Blockly.blockRendering.Measurable'], ['Blockly.blockRendering.Types'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/bottom_row.js', ['Blockly.blockRendering.BottomRow'], ['Blockly.blockRendering.Row', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/connections.js', ['Blockly.blockRendering.Connection', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection'], ['Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.utils.object']);
goog.addDependency('../../core/renderers/measurables/connection.js', ['Blockly.blockRendering.Connection'], ['Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.utils.object']);
goog.addDependency('../../core/renderers/measurables/external_value_input.js', ['Blockly.blockRendering.ExternalValueInput'], ['Blockly.blockRendering.InputConnection', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/field.js', ['Blockly.blockRendering.Field'], ['Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/hat.js', ['Blockly.blockRendering.Hat'], ['Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
@@ -160,6 +160,9 @@ goog.addDependency('../../core/renderers/measurables/inline_input.js', ['Blockly
goog.addDependency('../../core/renderers/measurables/input_connection.js', ['Blockly.blockRendering.InputConnection'], ['Blockly.blockRendering.Connection', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/input_row.js', ['Blockly.blockRendering.InputRow'], ['Blockly.blockRendering.Row', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/jagged_edge.js', ['Blockly.blockRendering.JaggedEdge'], ['Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/next_connection.js', ['Blockly.blockRendering.NextConnection'], ['Blockly.blockRendering.Connection', 'Blockly.blockRendering.Types', 'Blockly.utils.object']);
goog.addDependency('../../core/renderers/measurables/output_connection.js', ['Blockly.blockRendering.OutputConnection'], ['Blockly.blockRendering.Connection', 'Blockly.blockRendering.Types', 'Blockly.utils.object']);
goog.addDependency('../../core/renderers/measurables/previous_connection.js', ['Blockly.blockRendering.PreviousConnection'], ['Blockly.blockRendering.Connection', 'Blockly.blockRendering.Types', 'Blockly.utils.object']);
goog.addDependency('../../core/renderers/measurables/round_corner.js', ['Blockly.blockRendering.RoundCorner'], ['Blockly.blockRendering.Measurable', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/row.js', ['Blockly.blockRendering.Row'], ['Blockly.blockRendering.Types'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/renderers/measurables/spacer_row.js', ['Blockly.blockRendering.SpacerRow'], ['Blockly.blockRendering.InRowSpacer', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.Types', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});