Files
blockly/core/renderers/geras/constants.ts
Aaron Dodson 5870c66cf0 chore: Migrate ESLint configuration file to new flat format. (#8675)
* chore: rename .eslintrc.js to eslint.config.js

* chore: Rename eslint.config.js to eslint.config.mjs.

* refactor: Migrate ESLint config to new flat format.

* chore: Remove old per-directory and global ignore ESLint config files.

* fix: Allowlist JSDoc tag aliases.

* fix: Don't require @license in tests/*.

* fix: Add NodeJS globals to several files that run under Node.

* chore: Remove now-unneeded ESLint directives in core.

* chore: Remove invalid/unneeded ESLint directives.

* fix: Fix invalid use of `await` outside of an `async` function.

* fix: Improve screenshot error message.

* fix: Update ESLint config file to not warn on existing violations.

* chore: Remove suppressions of rules that weren't triggering.

* chore: Fix package-lock.json.
2024-12-03 12:40:48 -08:00

43 lines
1.1 KiB
TypeScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Former goog.module ID: 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([
// Insertion marker.
`${selector} .blocklyInsertionMarker>.blocklyPathLight,`,
`${selector} .blocklyInsertionMarker>.blocklyPathDark {`,
`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,
`stroke: none;`,
'}',
]);
}
}