mirror of
https://github.com/google/blockly.git
synced 2026-01-27 18:50:09 +01:00
* 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
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2019 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Objects representing a square corner in a row of a rendered
|
|
* block.
|
|
*/
|
|
|
|
/**
|
|
* Objects representing a square corner in a row of a rendered
|
|
* block.
|
|
* @class
|
|
*/
|
|
goog.module('Blockly.blockRendering.SquareCorner');
|
|
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
const {ConstantProvider} = goog.requireType('Blockly.blockRendering.ConstantProvider');
|
|
const {Measurable} = goog.require('Blockly.blockRendering.Measurable');
|
|
const {Types} = goog.require('Blockly.blockRendering.Types');
|
|
|
|
|
|
/**
|
|
* An object containing information about the space a square corner takes up
|
|
* during rendering.
|
|
* @extends {Measurable}
|
|
* @struct
|
|
*/
|
|
class SquareCorner extends Measurable {
|
|
/**
|
|
* @param {!ConstantProvider} constants The rendering
|
|
* constants provider.
|
|
* @param {string=} opt_position The position of this corner.
|
|
* @package
|
|
* @alias Blockly.blockRendering.SquareCorner
|
|
*/
|
|
constructor(constants, opt_position) {
|
|
super(constants);
|
|
this.type = ((!opt_position || opt_position === 'left') ?
|
|
Types.LEFT_SQUARE_CORNER :
|
|
Types.RIGHT_SQUARE_CORNER) |
|
|
Types.CORNER;
|
|
this.height = this.constants_.NO_PADDING;
|
|
this.width = this.constants_.NO_PADDING;
|
|
}
|
|
}
|
|
|
|
exports.SquareCorner = SquareCorner;
|