Files
blockly/core/renderers/measurables/connection.ts
Maribeth Bottorff 8173d139e1 feat: make renderer methods public or protected (#6887)
* feat: make renderering methods public or protected

* chore: formatting

* chore: recommend thrasos more strongly
2023-03-09 00:31:47 +00:00

41 lines
1.1 KiB
TypeScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
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.
*/
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.
*/
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;
}
}