mirror of
https://github.com/google/blockly.git
synced 2026-01-26 10:10:08 +01:00
* chore: add linting for tsdoc * chore: don't require types on return * chore: remove redundant fileoverview from ts * chore: change return to returns and add some newlines * chore: remove license tag * chore: don't require params/return docs * chore: remove spurious struct tags * Revert "chore: change return to returns and add some newlines" This reverts commitd6d8656a45. * chore: don't auto-add param names * chore: disable require-param bc it breaks on this * return to returns and add line breaks * chore: configure additional jsdoc rules * chore: run format * Revert "chore: remove license tag" This reverts commit173455588a. * chore: allow license tag format * chore: only require jsdoc on exported items * chore: add missing jsdoc or silence where needed * chore: run format * chore: lint fixes
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2019 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* Base class representing the space a connection takes up during
|
|
* rendering.
|
|
*
|
|
* @class
|
|
*/
|
|
import * as goog from '../../../closure/goog/goog.js';
|
|
goog.declareModuleId('Blockly.blockRendering.Connection');
|
|
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
import type {RenderedConnection} from '../../rendered_connection.js';
|
|
import type {ConstantProvider, Shape} from '../common/constants.js';
|
|
|
|
import {Measurable} from './base.js';
|
|
import {Types} from './types.js';
|
|
|
|
|
|
/**
|
|
* The base class to represent a connection and the space that it takes up on
|
|
* the block.
|
|
*
|
|
* @alias Blockly.blockRendering.Connection
|
|
*/
|
|
export class Connection extends Measurable {
|
|
shape: Shape;
|
|
isDynamicShape: boolean;
|
|
|
|
/**
|
|
* @param constants The rendering constants provider.
|
|
* @param connectionModel The connection object on the block that this
|
|
* represents.
|
|
* @internal
|
|
*/
|
|
constructor(
|
|
constants: ConstantProvider, public connectionModel: RenderedConnection) {
|
|
super(constants);
|
|
|
|
this.shape = this.constants_.shapeFor(connectionModel);
|
|
|
|
this.isDynamicShape = 'isDynamic' in this.shape && this.shape.isDynamic;
|
|
this.type |= Types.CONNECTION;
|
|
}
|
|
}
|