UNPKG

blockly

Version:

Blockly is a library for building visual programming editors.

50 lines (43 loc) 1.55 kB
/** * @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;