Files
blockly/core/renderers/geras/constants.js
Monica Kozbial d8fbe1b05b Add namespace and alias annotations to jsdoc (#5550)
* Add annotations to files under core/events

* Add annotations to files under core/interfaces

* Add annotations to files under core/keyboard_nav

* Add annotations to files under core/renderers

* Add annotations to files under core/serialization

* Add annotations to files under core/theme

* Add annotations to files under core/toolbox

* Add annotations to files under core/utils

* Add annotations to files under core
2021-09-27 14:42:54 -07:00

76 lines
1.8 KiB
JavaScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview An object that provides constants for rendering blocks in Geras
* mode.
* @author kozbial@google.com (Monica Kozbial)
*/
'use strict';
/**
* An object that provides constants for rendering blocks in Geras
* mode.
* @namespace Blockly.geras.ConstantProvider
*/
goog.module('Blockly.geras.ConstantProvider');
const BaseConstantProvider = goog.require('Blockly.blockRendering.ConstantProvider');
const object = goog.require('Blockly.utils.object');
/**
* An object that provides constants for rendering blocks in Geras mode.
* @constructor
* @package
* @extends {BaseConstantProvider}
* @alias Blockly.geras.ConstantProvider
*/
const ConstantProvider = function() {
ConstantProvider.superClass_.constructor.call(this);
/**
* @override
*/
this.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.
this.DARK_PATH_OFFSET = 1;
/**
* The maximum width of a bottom row that follows a statement input and has
* inputs inline.
* @type {number}
*/
this.MAX_BOTTOM_WIDTH = 30;
/**
* @override
*/
this.STATEMENT_BOTTOM_SPACER = -this.NOTCH_HEIGHT / 2;
};
object.inherits(ConstantProvider, BaseConstantProvider);
/**
* @override
*/
ConstantProvider.prototype.getCSS_ = function(selector) {
return ConstantProvider.superClass_.getCSS_.call(this, selector).concat([
/* eslint-disable indent */
// Insertion marker.
selector + ' .blocklyInsertionMarker>.blocklyPathLight,',
selector + ' .blocklyInsertionMarker>.blocklyPathDark {',
'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';',
'stroke: none;',
'}',
/* eslint-enable indent */
]);
};
exports = ConstantProvider;