Files
blockly/core/renderers/measurables/connection.js
Aaron Dodson edc2a5cd0c fix: Fix compilation errors under Closure's strict mode (#6073)
* fix: Fix errors under strict compilation.

* fix: Fix tests that referenced properties converted to data attributes.

* fix: Incorporate feedback on resolving compiler errors.

* refactor: Revert changes to skew and translate attributes.

* refactor: Introduce LegacyContextMenuOption type to correspond to documented fields.

* refactor: Introduce PathLeftShape and PathDownShape vs casting to PuzzleTab/Notch.

* chore: Added nullability modifiers to type annotations.

* refactor: Export FlyoutItem directly.

* chore: clang-format renderers/zelos/drawer.js.
2022-04-19 14:17:17 -07:00

56 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');
/* eslint-disable-next-line no-unused-vars */
const {ConstantProvider, Shape} = 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.
* @extends {Measurable}
* @alias Blockly.blockRendering.Connection
*/
class Connection extends Measurable {
/**
* @param {!ConstantProvider} constants The rendering
* constants provider.
* @param {!RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
*/
constructor(constants, connectionModel) {
super(constants);
/** @type {!RenderedConnection} */
this.connectionModel = connectionModel;
/** @type {!Shape} */
this.shape = this.constants_.shapeFor(connectionModel);
/** @type {boolean} */
this.isDynamicShape = !!this.shape['isDynamic'];
this.type |= Types.CONNECTION;
}
}
exports.Connection = Connection;