Files
blockly/core/renderers/measurables/connection.ts
Beka Westberg 702eed42db fix: highlighting connections in zelos, also highlight connections moving (#7795)
* fix: remove zelos highlight override

* feat: add isHighlighted to rendered connection

* feat: add refreshing connection highlighting

* chore: remove highlight and unhighlight connection APIs

* chore: PR comments
2024-02-02 11:55:14 -08:00

44 lines
1.1 KiB
TypeScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Former goog.module ID: 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;
highlighted: 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.type |= Types.CONNECTION;
this.shape = this.constants_.shapeFor(connectionModel);
this.isDynamicShape = 'isDynamic' in this.shape && this.shape.isDynamic;
this.highlighted = connectionModel.isHighlighted();
}
}