Files
blockly/core/renderers/measurables/connection.js
Aaron Dodson 3851b14627 refactor: Migrate to named exports (#5623)
* refactor: Migrate to named exports

* fix: Sort requires

* fix: Remove duplicate deps
2021-10-20 15:53:23 -07:00

50 lines
1.5 KiB
JavaScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Base class representing the space a connection takes up during
* rendering.
*/
/**
* Base class representing the space a connection takes up during
* rendering.
* @class
*/
goog.module('Blockly.blockRendering.Connection');
const object = goog.require('Blockly.utils.object');
/* 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');
/**
* The base class to represent a connection and the space that it takes up on
* the block.
* @param {!ConstantProvider} constants The rendering
* constants provider.
* @param {!RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @constructor
* @extends {Measurable}
* @alias Blockly.blockRendering.Connection
*/
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 |= Types.CONNECTION;
};
object.inherits(Connection, Measurable);
exports.Connection = Connection;