Files
blockly/core/renderers/measurables/output_connection.js
Rachel Fenichel 97c19be612 refactor: convert renderer measurables to es6 classes (#5899)
* chore: use casts to narrow types in renderers

* chore: add @struct and type information on common measurables

* refactor: update some renderer measurables to es6 classes

* refactor: convert many measurables to es6 classes

* chore: format

* chore: rebuild
2022-02-01 15:43:11 -08:00

62 lines
1.7 KiB
JavaScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Class representing the space a output connection takes up
* during rendering.
*/
/**
* Class representing the space a output connection takes up
* during rendering.
* @class
*/
goog.module('Blockly.blockRendering.OutputConnection');
const {Connection} = goog.require('Blockly.blockRendering.Connection');
/* eslint-disable-next-line no-unused-vars */
const {ConstantProvider} = goog.requireType('Blockly.blockRendering.ConstantProvider');
/* eslint-disable-next-line no-unused-vars */
const {RenderedConnection} = goog.requireType('Blockly.RenderedConnection');
const {Types} = goog.require('Blockly.blockRendering.Types');
/**
* An object containing information about the space an output connection takes
* up during rendering.
* @extends {Connection}
* @struct
*/
class OutputConnection extends Connection {
/**
* @param {!ConstantProvider} constants The rendering
* constants provider.
* @param {!RenderedConnection} connectionModel The connection object on
* the block that this represents.
* @package
* @alias Blockly.blockRendering.OutputConnection
*/
constructor(constants, connectionModel) {
super(constants, connectionModel);
this.type |= Types.OUTPUT_CONNECTION;
this.height = !this.isDynamicShape ? this.shape.height : 0;
this.width = !this.isDynamicShape ? this.shape.width : 0;
/** @type {number} */
this.startX = this.width;
/** @type {number} */
this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;
/** @type {number} */
this.connectionOffsetX = 0;
}
}
exports.OutputConnection = OutputConnection;