Files
blockly/core/renderers/geras/constants.ts
Maribeth Bottorff 88ff901a72 chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
2023-05-10 16:01:39 -07:00

48 lines
1.3 KiB
TypeScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as goog from '../../../closure/goog/goog.js';
goog.declareModuleId('Blockly.geras.ConstantProvider');
import {ConstantProvider as BaseConstantProvider} from '../common/constants.js';
/**
* An object that provides constants for rendering blocks in Geras mode.
*/
export class ConstantProvider extends BaseConstantProvider {
override FIELD_TEXT_BASELINE_CENTER = false;
// The dark/shadow path in classic rendering is the same as the normal block
// path, but translated down one and right one.
DARK_PATH_OFFSET = 1;
/**
* The maximum width of a bottom row that follows a statement input and has
* inputs inline.
*/
MAX_BOTTOM_WIDTH = 30;
override STATEMENT_BOTTOM_SPACER = -this.NOTCH_HEIGHT / 2;
constructor() {
super();
}
override getCSS_(selector: string) {
return super.getCSS_(selector).concat([
/* eslint-disable indent */
/* clang-format off */
// Insertion marker.
`${selector} .blocklyInsertionMarker>.blocklyPathLight,`,
`${selector} .blocklyInsertionMarker>.blocklyPathDark {`,
`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,
`stroke: none;`,
'}',
/* clang-format on */
/* eslint-enable indent */
]);
}
}