mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
chore: Lint TsDoc. (#6353)
* chore: add linting for tsdoc * chore: don't require types on return * chore: remove redundant fileoverview from ts * chore: change return to returns and add some newlines * chore: remove license tag * chore: don't require params/return docs * chore: remove spurious struct tags * Revert "chore: change return to returns and add some newlines" This reverts commitd6d8656a45. * chore: don't auto-add param names * chore: disable require-param bc it breaks on this * return to returns and add line breaks * chore: configure additional jsdoc rules * chore: run format * Revert "chore: remove license tag" This reverts commit173455588a. * chore: allow license tag format * chore: only require jsdoc on exported items * chore: add missing jsdoc or silence where needed * chore: run format * chore: lint fixes
This commit is contained in:
committed by
GitHub
parent
bb37d1b7aa
commit
037eb59b89
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Namespace for block rendering functionality.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Namespace for block rendering functionality.
|
||||
*
|
||||
* @namespace Blockly.blockRendering
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -54,7 +51,8 @@ import {Renderer} from './renderer.js';
|
||||
|
||||
/**
|
||||
* Returns whether the debugger is turned on.
|
||||
* @return Whether the debugger is turned on.
|
||||
*
|
||||
* @returns Whether the debugger is turned on.
|
||||
* @alias Blockly.blockRendering.isDebuggerEnabled
|
||||
* @deprecated
|
||||
* @internal
|
||||
@@ -69,6 +67,7 @@ export function isDebuggerEnabled(): boolean {
|
||||
|
||||
/**
|
||||
* Registers a new renderer.
|
||||
*
|
||||
* @param name The name of the renderer.
|
||||
* @param rendererClass The new renderer class to register.
|
||||
* @throws {Error} if a renderer with the same name has already been registered.
|
||||
@@ -79,6 +78,7 @@ export function register(name: string, rendererClass: Function) {
|
||||
|
||||
/**
|
||||
* Unregisters the renderer registered with the given name.
|
||||
*
|
||||
* @param name The name of the renderer.
|
||||
* @alias Blockly.blockRendering.unregister
|
||||
*/
|
||||
@@ -88,6 +88,7 @@ export function unregister(name: string) {
|
||||
|
||||
/**
|
||||
* Turn on the blocks debugger.
|
||||
*
|
||||
* @alias Blockly.blockRendering.startDebugger
|
||||
* @deprecated
|
||||
* @internal
|
||||
@@ -102,6 +103,7 @@ export function startDebugger() {
|
||||
|
||||
/**
|
||||
* Turn off the blocks debugger.
|
||||
*
|
||||
* @alias Blockly.blockRendering.stopDebugger
|
||||
* @deprecated
|
||||
* @internal
|
||||
@@ -116,10 +118,11 @@ export function stopDebugger() {
|
||||
|
||||
/**
|
||||
* Initialize anything needed for rendering (constants, etc).
|
||||
*
|
||||
* @param name Name of the renderer to initialize.
|
||||
* @param theme The workspace theme object.
|
||||
* @param opt_rendererOverrides Rendering constant overrides.
|
||||
* @return The new instance of a renderer.
|
||||
* @returns The new instance of a renderer.
|
||||
* Already initialized.
|
||||
* @alias Blockly.blockRendering.init
|
||||
* @internal
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object that provides constants for rendering blocks.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -98,6 +95,7 @@ export type Shape = BaseShape|DynamicShape;
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks.
|
||||
*
|
||||
* @alias Blockly.blockRendering.ConstantProvider
|
||||
*/
|
||||
export class ConstantProvider {
|
||||
@@ -231,6 +229,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* The backing colour of a field's border rect.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
FIELD_BORDER_RECT_COLOUR = '#fff';
|
||||
@@ -284,6 +283,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* The ID of the emboss filter, or the empty string if no filter is set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
embossFilterId = '';
|
||||
@@ -295,6 +295,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* The ID of the disabled pattern, or the empty string if no pattern is set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
disabledPatternId = '';
|
||||
@@ -325,48 +326,56 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Cursor colour.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
CURSOR_COLOUR = '#cc0a0a';
|
||||
|
||||
/**
|
||||
* Immovable marker colour.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
MARKER_COLOUR = '#4286f4';
|
||||
|
||||
/**
|
||||
* Width of the horizontal cursor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
CURSOR_WS_WIDTH = 100;
|
||||
|
||||
/**
|
||||
* Height of the horizontal cursor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
WS_CURSOR_HEIGHT = 5;
|
||||
|
||||
/**
|
||||
* Padding around a stack.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
CURSOR_STACK_PADDING = 10;
|
||||
|
||||
/**
|
||||
* Padding around a block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
CURSOR_BLOCK_PADDING = 2;
|
||||
|
||||
/**
|
||||
* Stroke of the cursor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
CURSOR_STROKE_WIDTH = 4;
|
||||
|
||||
/**
|
||||
* Whether text input and colour fields fill up the entire source block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
FULL_BLOCK_FIELDS = false;
|
||||
@@ -374,12 +383,14 @@ export class ConstantProvider {
|
||||
/**
|
||||
* The main colour of insertion markers, in hex. The block is rendered a
|
||||
* transparent grey by changing the fill opacity in CSS.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
INSERTION_MARKER_COLOUR = '#000000';
|
||||
|
||||
/**
|
||||
* The insertion marker opacity.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
INSERTION_MARKER_OPACITY = 0.2;
|
||||
@@ -482,6 +493,7 @@ export class ConstantProvider {
|
||||
/**
|
||||
* A random identifier used to ensure a unique ID is used for each
|
||||
* filter/pattern for the case of multiple Blockly instances on a page.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
this.randomIdentifier = String(Math.random()).substring(2);
|
||||
@@ -489,6 +501,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Initialize shape objects based on the constants set in the constructor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
init() {
|
||||
@@ -522,6 +535,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Refresh constants properties that depend on the theme.
|
||||
*
|
||||
* @param theme The current workspace theme.
|
||||
* @internal
|
||||
*/
|
||||
@@ -539,6 +553,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Sets dynamic properties that depend on other values or theme properties.
|
||||
*
|
||||
* @param theme The current workspace theme.
|
||||
*/
|
||||
protected setDynamicProperties_(theme: Theme) {
|
||||
@@ -551,6 +566,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Set constants related to fonts.
|
||||
*
|
||||
* @param theme The current workspace theme.
|
||||
*/
|
||||
protected setFontConstants_(theme: Theme) {
|
||||
@@ -576,6 +592,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Set constants from a theme's component styles.
|
||||
*
|
||||
* @param theme The current workspace theme.
|
||||
*/
|
||||
protected setComponentConstants_(theme: Theme) {
|
||||
@@ -594,8 +611,9 @@ export class ConstantProvider {
|
||||
/**
|
||||
* Get or create a block style based on a single colour value. Generate a
|
||||
* name for the style based on the colour.
|
||||
*
|
||||
* @param colour #RRGGBB colour string.
|
||||
* @return An object containing the style and an autogenerated name for that
|
||||
* @returns An object containing the style and an autogenerated name for that
|
||||
* style.
|
||||
* @internal
|
||||
*/
|
||||
@@ -609,8 +627,9 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Gets the BlockStyle for the given block style name.
|
||||
*
|
||||
* @param blockStyleName The name of the block style.
|
||||
* @return The named block style, or a default style if no style with the
|
||||
* @returns The named block style, or a default style if no style with the
|
||||
* given name was found.
|
||||
*/
|
||||
getBlockStyle(blockStyleName: string|null): BlockStyle {
|
||||
@@ -622,8 +641,9 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Create a block style object based on the given colour.
|
||||
*
|
||||
* @param colour #RRGGBB colour string.
|
||||
* @return A populated block style based on the given colour.
|
||||
* @returns A populated block style based on the given colour.
|
||||
*/
|
||||
protected createBlockStyle_(colour: string): BlockStyle {
|
||||
return this.validatedBlockStyle_({'colourPrimary': colour});
|
||||
@@ -632,8 +652,9 @@ export class ConstantProvider {
|
||||
/**
|
||||
* Get a full block style object based on the input style object. Populate
|
||||
* any missing values.
|
||||
*
|
||||
* @param blockStyle A full or partial block style object.
|
||||
* @return A full block style object, with all required properties populated.
|
||||
* @returns A full block style object, with all required properties populated.
|
||||
*/
|
||||
protected validatedBlockStyle_(blockStyle: {
|
||||
colourPrimary: string,
|
||||
@@ -663,8 +684,9 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Generate a secondary colour from the passed in primary colour.
|
||||
*
|
||||
* @param inputColour Primary colour.
|
||||
* @return The generated secondary colour.
|
||||
* @returns The generated secondary colour.
|
||||
*/
|
||||
protected generateSecondaryColour_(inputColour: string): string {
|
||||
return colour.blend('#fff', inputColour, 0.6) || inputColour;
|
||||
@@ -672,8 +694,9 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Generate a tertiary colour from the passed in primary colour.
|
||||
*
|
||||
* @param inputColour Primary colour.
|
||||
* @return The generated tertiary colour.
|
||||
* @returns The generated tertiary colour.
|
||||
*/
|
||||
protected generateTertiaryColour_(inputColour: string): string {
|
||||
return colour.blend('#fff', inputColour, 0.3) || inputColour;
|
||||
@@ -682,6 +705,7 @@ export class ConstantProvider {
|
||||
/**
|
||||
* Dispose of this constants provider.
|
||||
* Delete all DOM elements that this provider created.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
dispose() {
|
||||
@@ -700,7 +724,7 @@ export class ConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about collapsed
|
||||
* @returns An object containing sizing and path information about collapsed
|
||||
* block indicators.
|
||||
* @internal
|
||||
*/
|
||||
@@ -717,7 +741,7 @@ export class ConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about start hats.
|
||||
* @returns An object containing sizing and path information about start hats.
|
||||
* @internal
|
||||
*/
|
||||
makeStartHat(): StartHat {
|
||||
@@ -733,7 +757,8 @@ export class ConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about puzzle tabs.
|
||||
* @returns An object containing sizing and path information about puzzle
|
||||
* tabs.
|
||||
* @internal
|
||||
*/
|
||||
makePuzzleTab(): PuzzleTab {
|
||||
@@ -746,9 +771,10 @@ export class ConstantProvider {
|
||||
* versions of the paths are the same, but the Y sign flips. Forward and
|
||||
* back are the signs to use to move the cursor in the direction that the
|
||||
* path is being drawn.
|
||||
*
|
||||
* @param up True if the path should be drawn from bottom to top, false
|
||||
* otherwise.
|
||||
* @return A path fragment describing a puzzle tab.
|
||||
* @returns A path fragment describing a puzzle tab.
|
||||
*/
|
||||
function makeMainPath(up: boolean): string {
|
||||
const forward = up ? -1 : 1;
|
||||
@@ -789,7 +815,7 @@ export class ConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about notches.
|
||||
* @returns An object containing sizing and path information about notches.
|
||||
* @internal
|
||||
*/
|
||||
makeNotch(): Notch {
|
||||
@@ -800,9 +826,10 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Make the main path for the notch.
|
||||
*
|
||||
* @param dir Direction multiplier to apply to horizontal offsets along the
|
||||
* path. Either 1 or -1.
|
||||
* @return A path fragment describing a notch.
|
||||
* @returns A path fragment describing a notch.
|
||||
*/
|
||||
function makeMainPath(dir: number): string {
|
||||
return svgPaths.line([
|
||||
@@ -824,7 +851,7 @@ export class ConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about inside
|
||||
* @returns An object containing sizing and path information about inside
|
||||
* corners.
|
||||
* @internal
|
||||
*/
|
||||
@@ -846,7 +873,7 @@ export class ConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about outside
|
||||
* @returns An object containing sizing and path information about outside
|
||||
* corners.
|
||||
* @internal
|
||||
*/
|
||||
@@ -880,8 +907,9 @@ export class ConstantProvider {
|
||||
/**
|
||||
* Get an object with connection shape and sizing information based on the
|
||||
* type of the connection.
|
||||
*
|
||||
* @param connection The connection to find a shape object for
|
||||
* @return The shape object for the connection.
|
||||
* @returns The shape object for the connection.
|
||||
* @internal
|
||||
*/
|
||||
shapeFor(connection: RenderedConnection): Shape {
|
||||
@@ -899,6 +927,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Create any DOM elements that this renderer needs (filters, patterns, etc).
|
||||
*
|
||||
* @param svg The root of the workspace's SVG.
|
||||
* @param tagName The name to use for the CSS style tag.
|
||||
* @param selector The CSS selector to use.
|
||||
@@ -1049,6 +1078,7 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Inject renderer specific CSS into the page.
|
||||
*
|
||||
* @param tagName The name of the style tag to use.
|
||||
* @param selector The CSS selector to use.
|
||||
*/
|
||||
@@ -1073,8 +1103,9 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* Get any renderer specific CSS to inject when the renderer is initialized.
|
||||
*
|
||||
* @param selector CSS selector to use.
|
||||
* @return Array of CSS strings.
|
||||
* @returns Array of CSS strings.
|
||||
*/
|
||||
protected getCSS_(selector: string): string[] {
|
||||
return [
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Block rendering debugging functionality.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Block rendering debugging functionality.
|
||||
*
|
||||
* @namespace Blockly.blockRendering.debug
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -22,7 +19,8 @@ import * as deprecation from '../../utils/deprecation.js';
|
||||
let useDebugger = false;
|
||||
/**
|
||||
* Returns whether the debugger is turned on.
|
||||
* @return Whether the debugger is turned on.
|
||||
*
|
||||
* @returns Whether the debugger is turned on.
|
||||
* @alias Blockly.blockRendering.debug.isDebuggerEnabled
|
||||
* @internal
|
||||
*/
|
||||
@@ -32,6 +30,7 @@ export function isDebuggerEnabled(): boolean {
|
||||
|
||||
/**
|
||||
* Turn on the blocks debugger.
|
||||
*
|
||||
* @alias Blockly.blockRendering.debug.startDebugger
|
||||
* @deprecated March 2022. Use the rendering debugger in @blockly/dev-tools.
|
||||
* See https://www.npmjs.com/package/@blockly/dev-tools for more information.
|
||||
@@ -47,6 +46,7 @@ export function startDebugger() {
|
||||
|
||||
/**
|
||||
* Turn off the blocks debugger.
|
||||
*
|
||||
* @alias Blockly.blockRendering.debug.stopDebugger
|
||||
* @deprecated March 2022. Use the rendering debugger in @blockly/dev-tools.
|
||||
* See https://www.npmjs.com/package/@blockly/dev-tools for more information.
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Methods for rendering debug graphics.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for rendering debug graphics.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -35,13 +32,13 @@ import type {RenderInfo} from './info.js';
|
||||
|
||||
/**
|
||||
* An object that renders rectangles and dots for debugging rendering code.
|
||||
*
|
||||
* @alias Blockly.blockRendering.Debug
|
||||
*/
|
||||
export class Debug {
|
||||
/**
|
||||
* Configuration object containing booleans to enable and disable debug
|
||||
* rendering of specific rendering components.
|
||||
* @struct
|
||||
*/
|
||||
static config = {
|
||||
rowSpacers: true,
|
||||
@@ -75,6 +72,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Remove all elements the this object created on the last pass.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
clearElems() {
|
||||
@@ -88,6 +86,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Draw a debug rectangle for a spacer (empty) row.
|
||||
*
|
||||
* @param row The row to render.
|
||||
* @param cursorY The y position of the top of the row.
|
||||
* @param isRtl Whether the block is rendered RTL.
|
||||
@@ -121,6 +120,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Draw a debug rectangle for a horizontal spacer.
|
||||
*
|
||||
* @param elem The spacer to render.
|
||||
* @param rowHeight The height of the container row.
|
||||
* @param isRtl Whether the block is rendered RTL.
|
||||
@@ -155,6 +155,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Draw a debug rectangle for an in-row element.
|
||||
*
|
||||
* @param elem The element to render.
|
||||
* @param isRtl Whether the block is rendered RTL.
|
||||
* @internal
|
||||
@@ -207,6 +208,7 @@ export class Debug {
|
||||
* Draw a circle at the location of the given connection. Inputs and outputs
|
||||
* share the same colours, as do previous and next. When positioned correctly
|
||||
* a connected pair will look like a bullseye.
|
||||
*
|
||||
* @param conn The connection to circle.
|
||||
* @suppress {visibility} Suppress visibility of conn.offsetInBlock_ since
|
||||
* this is a debug module.
|
||||
@@ -255,6 +257,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Draw a debug rectangle for a non-empty row.
|
||||
*
|
||||
* @param row The non-empty row to render.
|
||||
* @param cursorY The y position of the top of the row.
|
||||
* @param isRtl Whether the block is rendered RTL.
|
||||
@@ -302,6 +305,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Draw debug rectangles for a non-empty row and all of its subcomponents.
|
||||
*
|
||||
* @param row The non-empty row to render.
|
||||
* @param cursorY The y position of the top of the row.
|
||||
* @param isRtl Whether the block is rendered RTL.
|
||||
@@ -325,6 +329,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Draw a debug rectangle around the entire block.
|
||||
*
|
||||
* @param info Rendering information about the block to debug.
|
||||
* @internal
|
||||
*/
|
||||
@@ -370,6 +375,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Do all of the work to draw debug information for the whole block.
|
||||
*
|
||||
* @param block The block to draw debug information for.
|
||||
* @param info Rendering information about the block to debug.
|
||||
* @internal
|
||||
@@ -417,6 +423,7 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* Show a debug filter to highlight that a block has been rendered.
|
||||
*
|
||||
* @param svgPath The block's SVG path.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Methods for graphically rendering a block as SVG.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a block as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -33,6 +30,7 @@ import type {RenderInfo} from './info.js';
|
||||
|
||||
/**
|
||||
* An object that draws a block based on the given rendering information.
|
||||
*
|
||||
* @alias Blockly.blockRendering.Drawer
|
||||
*/
|
||||
export class Drawer {
|
||||
@@ -66,6 +64,7 @@ export class Drawer {
|
||||
* joined with spaces and set directly on the block. This guarantees that
|
||||
* the steps are separated by spaces for improved readability, but isn't
|
||||
* required.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
draw() {
|
||||
@@ -155,6 +154,7 @@ export class Drawer {
|
||||
|
||||
/**
|
||||
* Add steps for the jagged edge of a row on a collapsed block.
|
||||
*
|
||||
* @param row The row to draw the side of.
|
||||
*/
|
||||
protected drawJaggedEdge_(row: Row) {
|
||||
@@ -166,6 +166,7 @@ export class Drawer {
|
||||
/**
|
||||
* Add steps for an external value input, rendered as a notch in the side
|
||||
* of the block.
|
||||
*
|
||||
* @param row The row that this input belongs to.
|
||||
*/
|
||||
protected drawValueInput_(row: Row) {
|
||||
@@ -189,6 +190,7 @@ export class Drawer {
|
||||
|
||||
/**
|
||||
* Add steps for a statement input.
|
||||
*
|
||||
* @param row The row that this input belongs to.
|
||||
*/
|
||||
protected drawStatementInput_(row: Row) {
|
||||
@@ -214,6 +216,7 @@ export class Drawer {
|
||||
/**
|
||||
* Add steps for the right side of a row that does not have value or
|
||||
* statement input connections.
|
||||
*
|
||||
* @param row The row to draw the side of.
|
||||
*/
|
||||
protected drawRightSideRow_(row: Row) {
|
||||
@@ -293,6 +296,7 @@ export class Drawer {
|
||||
|
||||
/**
|
||||
* Push a field or icon's new position to its SVG root.
|
||||
*
|
||||
* @param fieldInfo The rendering information for the field or icon.
|
||||
*/
|
||||
protected layoutField_(fieldInfo: Icon|Field) {
|
||||
@@ -340,6 +344,7 @@ export class Drawer {
|
||||
|
||||
/**
|
||||
* Add steps for an inline input.
|
||||
*
|
||||
* @param input The information about the input to render.
|
||||
*/
|
||||
protected drawInlineInput_(input: InlineInput) {
|
||||
@@ -365,6 +370,7 @@ export class Drawer {
|
||||
* Position the connection on an inline value input, taking into account
|
||||
* RTL and the small gap between the parent block and child block which lets
|
||||
* the parent block's dark path show through.
|
||||
*
|
||||
* @param input The information about the input that the connection is on.
|
||||
*/
|
||||
protected positionInlineInputConnection_(input: InlineInput) {
|
||||
@@ -385,6 +391,7 @@ export class Drawer {
|
||||
* Position the connection on a statement input, taking into account
|
||||
* RTL and the small gap between the parent block and child block which lets
|
||||
* the parent block's dark path show through.
|
||||
*
|
||||
* @param row The row that the connection is on.
|
||||
*/
|
||||
protected positionStatementInputConnection_(row: Row) {
|
||||
@@ -402,6 +409,7 @@ export class Drawer {
|
||||
* Position the connection on an external value input, taking into account
|
||||
* RTL and the small gap between the parent block and child block which lets
|
||||
* the parent block's dark path show through.
|
||||
*
|
||||
* @param row The row that the connection is on.
|
||||
*/
|
||||
protected positionExternalValueConnection_(row: Row) {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview The interface for an object that owns a block's rendering SVG
|
||||
* elements.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The interface for an object that owns a block's rendering SVG
|
||||
* elements.
|
||||
*
|
||||
* @namespace Blockly.blockRendering.IPathObject
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -34,6 +30,7 @@ import type {ConstantProvider} from './constants.js';
|
||||
|
||||
/**
|
||||
* An interface for a block's path object.
|
||||
*
|
||||
* @param _root The root SVG element.
|
||||
* @param _constants The renderer's constants.
|
||||
* @alias Blockly.blockRendering.IPathObject
|
||||
@@ -62,6 +59,7 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Set the path generated by the renderer onto the respective SVG element.
|
||||
*
|
||||
* @param pathString The path.
|
||||
* @internal
|
||||
*/
|
||||
@@ -70,6 +68,7 @@ export interface IPathObject {
|
||||
/**
|
||||
* Apply the stored colours to the block's path, taking into account whether
|
||||
* the paths belong to a shadow block.
|
||||
*
|
||||
* @param block The source block.
|
||||
* @internal
|
||||
*/
|
||||
@@ -77,6 +76,7 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Update the style.
|
||||
*
|
||||
* @param blockStyle The block style to use.
|
||||
* @internal
|
||||
*/
|
||||
@@ -84,12 +84,14 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Flip the SVG paths in RTL.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
flipRTL: () => void;
|
||||
|
||||
/**
|
||||
* Add the cursor SVG to this block's SVG group.
|
||||
*
|
||||
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
@@ -98,6 +100,7 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Add the marker SVG to this block's SVG group.
|
||||
*
|
||||
* @param markerSvg The SVG root of the marker to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
@@ -107,6 +110,7 @@ export interface IPathObject {
|
||||
/**
|
||||
* Set whether the block shows a highlight or not. Block highlighting is
|
||||
* often used to visually mark blocks currently being executed.
|
||||
*
|
||||
* @param highlighted True if highlighted.
|
||||
* @internal
|
||||
*/
|
||||
@@ -114,6 +118,7 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is selected.
|
||||
*
|
||||
* @param enable True if selection is enabled, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
@@ -121,6 +126,7 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is dragged over a delete area.
|
||||
*
|
||||
* @param enable True if the block is being dragged over a delete area, false
|
||||
* otherwise.
|
||||
* @internal
|
||||
@@ -129,6 +135,7 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is an insertion marker.
|
||||
*
|
||||
* @param enable True if the block is an insertion marker, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
@@ -136,6 +143,7 @@ export interface IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is movable.
|
||||
*
|
||||
* @param enable True if the block is movable, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
@@ -145,6 +153,7 @@ export interface IPathObject {
|
||||
* Add or remove styling that shows that if the dragging block is dropped,
|
||||
* this block will be replaced. If a shadow block, it will disappear.
|
||||
* Otherwise it will bump.
|
||||
*
|
||||
* @param enable True if styling should be added.
|
||||
* @internal
|
||||
*/
|
||||
@@ -153,6 +162,7 @@ export interface IPathObject {
|
||||
/**
|
||||
* Add or remove styling that shows that if the dragging block is dropped,
|
||||
* this block will be connected to the input.
|
||||
*
|
||||
* @param conn The connection on the input to highlight.
|
||||
* @param enable True if styling should be added.
|
||||
* @internal
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Methods for graphically rendering a block as SVG.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a block as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -50,6 +47,7 @@ import type {Renderer} from './renderer.js';
|
||||
* This measure pass does not propagate changes to the block (although fields
|
||||
* may choose to rerender when getSize() is called). However, calling it
|
||||
* repeatedly may be expensive.
|
||||
*
|
||||
* @alias Blockly.blockRendering.RenderInfo
|
||||
*/
|
||||
export class RenderInfo {
|
||||
@@ -149,7 +147,8 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Get the block renderer in use.
|
||||
* @return The block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
getRenderer(): Renderer {
|
||||
@@ -163,6 +162,7 @@ export class RenderInfo {
|
||||
* This measure pass does not propagate changes to the block (although fields
|
||||
* may choose to rerender when getSize() is called). However, calling it
|
||||
* repeatedly may be expensive.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
measure() {
|
||||
@@ -231,6 +231,7 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Create all non-spacer elements that belong on the top row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
populateTopRow_() {
|
||||
@@ -275,6 +276,7 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Create all non-spacer elements that belong on the bottom row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
populateBottomRow_() {
|
||||
@@ -319,6 +321,7 @@ export class RenderInfo {
|
||||
/**
|
||||
* Add an input element to the active row, if needed, and record the type of
|
||||
* the input on the row.
|
||||
*
|
||||
* @param input The input to record information about.
|
||||
* @param activeRow The row that is currently being populated.
|
||||
*/
|
||||
@@ -350,9 +353,10 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Decide whether to start a new row between the two Blockly.Inputs.
|
||||
*
|
||||
* @param input The first input to consider
|
||||
* @param lastInput The input that follows.
|
||||
* @return True if the next input should be rendered on a new row.
|
||||
* @returns True if the next input should be rendered on a new row.
|
||||
*/
|
||||
protected shouldStartNewRow_(input: Input, lastInput: Input): boolean {
|
||||
// If this is the first input, just add to the existing row.
|
||||
@@ -405,9 +409,10 @@ export class RenderInfo {
|
||||
* Calculate the width of a spacer element in a row based on the previous and
|
||||
* next elements in that row. For instance, extra padding is added between
|
||||
* two editable fields.
|
||||
*
|
||||
* @param prev The element before the spacer.
|
||||
* @param next The element after the spacer.
|
||||
* @return The size of the spacing between the two elements.
|
||||
* @returns The size of the spacing between the two elements.
|
||||
*/
|
||||
protected getInRowSpacing_(prev: Measurable|null, next: Measurable|null):
|
||||
number {
|
||||
@@ -513,8 +518,9 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Calculate the desired width of an input row.
|
||||
*
|
||||
* @param _row The input row.
|
||||
* @return The desired width of the input row.
|
||||
* @returns The desired width of the input row.
|
||||
*/
|
||||
protected getDesiredRowWidth_(_row: Row): number {
|
||||
return this.width - this.startX;
|
||||
@@ -524,6 +530,7 @@ export class RenderInfo {
|
||||
* Modify the given row to add the given amount of padding around its fields.
|
||||
* The exact location of the padding is based on the alignment property of the
|
||||
* last input in the field.
|
||||
*
|
||||
* @param row The row to add padding to.
|
||||
* @param missingSpace How much padding to add.
|
||||
*/
|
||||
@@ -555,6 +562,7 @@ export class RenderInfo {
|
||||
/**
|
||||
* Align the elements of a statement row based on computed bounds.
|
||||
* Unlike other types of rows, statement rows add space in multiple places.
|
||||
*
|
||||
* @param row The statement row to resize.
|
||||
*/
|
||||
protected alignStatementRow_(row: InputRow) {
|
||||
@@ -592,9 +600,10 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Create a spacer row to go between prev and next, and set its size.
|
||||
*
|
||||
* @param prev The previous row.
|
||||
* @param next The next row.
|
||||
* @return The newly created spacer row.
|
||||
* @returns The newly created spacer row.
|
||||
*/
|
||||
protected makeSpacerRow_(prev: Row, next: Row): SpacerRow {
|
||||
const height = this.getSpacerRowHeight_(prev, next);
|
||||
@@ -611,9 +620,10 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Calculate the width of a spacer row.
|
||||
*
|
||||
* @param _prev The row before the spacer.
|
||||
* @param _next The row after the spacer.
|
||||
* @return The desired width of the spacer row between these two rows.
|
||||
* @returns The desired width of the spacer row between these two rows.
|
||||
*/
|
||||
protected getSpacerRowWidth_(_prev: Row, _next: Row): number {
|
||||
return this.width - this.startX;
|
||||
@@ -621,9 +631,10 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Calculate the height of a spacer row.
|
||||
*
|
||||
* @param _prev The row before the spacer.
|
||||
* @param _next The row after the spacer.
|
||||
* @return The desired height of the spacer row between these two rows.
|
||||
* @returns The desired height of the spacer row between these two rows.
|
||||
*/
|
||||
protected getSpacerRowHeight_(_prev: Row, _next: Row): number {
|
||||
return this.constants_.MEDIUM_PADDING;
|
||||
@@ -634,9 +645,10 @@ export class RenderInfo {
|
||||
* This base implementation puts the centerline at the middle of the row
|
||||
* vertically, with no special cases. You will likely need extra logic to
|
||||
* handle (at minimum) top and bottom rows.
|
||||
*
|
||||
* @param row The row containing the element.
|
||||
* @param elem The element to place.
|
||||
* @return The desired centerline of the given element, as an offset from the
|
||||
* @returns The desired centerline of the given element, as an offset from the
|
||||
* top left of the block.
|
||||
*/
|
||||
protected getElemCenterline_(row: Row, elem: Measurable): number {
|
||||
@@ -667,6 +679,7 @@ export class RenderInfo {
|
||||
/**
|
||||
* Record final position information on elements on the given row, for use in
|
||||
* drawing. At minimum this records xPos and centerline on each element.
|
||||
*
|
||||
* @param row The row containing the elements.
|
||||
*/
|
||||
protected recordElemPositions_(row: Row) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Methods for graphically rendering a marker as SVG.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a marker as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -49,6 +46,7 @@ const HEIGHT_MULTIPLIER = 3 / 4;
|
||||
|
||||
/**
|
||||
* Class for a marker.
|
||||
*
|
||||
* @alias Blockly.blockRendering.MarkerSvg
|
||||
*/
|
||||
export class MarkerSvg {
|
||||
@@ -95,7 +93,8 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Return the root node of the SVG or null if none exists.
|
||||
* @return The root SVG node.
|
||||
*
|
||||
* @returns The root SVG node.
|
||||
*/
|
||||
getSvgRoot(): SVGElement {
|
||||
// AnyDuringMigration because: Type 'SVGGElement | null' is not assignable
|
||||
@@ -105,7 +104,8 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Get the marker.
|
||||
* @return The marker to draw for.
|
||||
*
|
||||
* @returns The marker to draw for.
|
||||
*/
|
||||
getMarker(): Marker {
|
||||
return this.marker;
|
||||
@@ -114,7 +114,8 @@ export class MarkerSvg {
|
||||
/**
|
||||
* True if the marker should be drawn as a cursor, false otherwise.
|
||||
* A cursor is drawn as a flashing line. A marker is drawn as a solid line.
|
||||
* @return True if the marker is a cursor, false otherwise.
|
||||
*
|
||||
* @returns True if the marker is a cursor, false otherwise.
|
||||
*/
|
||||
isCursor(): boolean {
|
||||
return this.marker.type === 'cursor';
|
||||
@@ -122,7 +123,8 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Create the DOM element for the marker.
|
||||
* @return The marker controls SVG group.
|
||||
*
|
||||
* @returns The marker controls SVG group.
|
||||
* @internal
|
||||
*/
|
||||
createDom(): SVGElement {
|
||||
@@ -136,6 +138,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Attaches the SVG root of the marker to the SVG group of the parent.
|
||||
*
|
||||
* @param newParent The workspace, field, or block that the marker SVG element
|
||||
* should be attached to.
|
||||
*/
|
||||
@@ -156,6 +159,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Update the marker.
|
||||
*
|
||||
* @param oldNode The previous node the marker was on or null.
|
||||
* @param curNode The node that we want to draw the marker for.
|
||||
*/
|
||||
@@ -185,6 +189,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Update the marker's visible state based on the type of curNode..
|
||||
*
|
||||
* @param curNode The node that we want to draw the marker for.
|
||||
*/
|
||||
protected showAtLocation_(curNode: ASTNode) {
|
||||
@@ -216,6 +221,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Show the marker as a combination of the previous connection and block,
|
||||
* the output connection and block, or just the block.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
private showWithBlockPrevOutput_(curNode: ASTNode) {
|
||||
@@ -244,6 +250,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Position and display the marker for a block.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithBlock_(curNode: ASTNode) {
|
||||
@@ -252,6 +259,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Position and display the marker for a previous connection.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithPrevious_(curNode: ASTNode) {
|
||||
@@ -260,6 +268,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Position and display the marker for an output connection.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithOutput_(curNode: ASTNode) {
|
||||
@@ -269,6 +278,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position and display the marker for a workspace coordinate.
|
||||
* This is a horizontal line.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithCoordinates_(curNode: ASTNode) {
|
||||
@@ -288,6 +298,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position and display the marker for a field.
|
||||
* This is a box around the field.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithField_(curNode: ASTNode) {
|
||||
@@ -303,6 +314,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position and display the marker for an input.
|
||||
* This is a puzzle piece.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithInput_(curNode: ASTNode) {
|
||||
@@ -317,6 +329,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position and display the marker for a next connection.
|
||||
* This is a horizontal line.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithNext_(curNode: ASTNode) {
|
||||
@@ -336,6 +349,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position and display the marker for a stack.
|
||||
* This is a box with extra padding around the entire stack of blocks.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
protected showWithStack_(curNode: ASTNode) {
|
||||
@@ -380,6 +394,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position the marker for a block.
|
||||
* Displays an outline of the top half of a rectangle around a block.
|
||||
*
|
||||
* @param width The width of the block.
|
||||
* @param markerOffset The extra padding for around the block.
|
||||
* @param markerHeight The height of the marker.
|
||||
@@ -402,6 +417,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position the marker for an input connection.
|
||||
* Displays a filled in puzzle piece.
|
||||
*
|
||||
* @param connection The connection to position marker around.
|
||||
*/
|
||||
protected positionInput_(connection: RenderedConnection) {
|
||||
@@ -422,6 +438,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Move and show the marker at the specified coordinate in workspace units.
|
||||
* Displays a horizontal line.
|
||||
*
|
||||
* @param x The new x, in workspace units.
|
||||
* @param y The new y, in workspace units.
|
||||
* @param width The new width, in workspace units.
|
||||
@@ -442,6 +459,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Position the marker for an output connection.
|
||||
* Displays a puzzle outline and the top and bottom path.
|
||||
*
|
||||
* @param width The width of the block.
|
||||
* @param height The height of the block.
|
||||
* @param connectionShape The shape object for the connection.
|
||||
@@ -468,6 +486,7 @@ export class MarkerSvg {
|
||||
* Position the marker for a previous connection.
|
||||
* Displays a half rectangle with a notch in the top to represent the previous
|
||||
* connection.
|
||||
*
|
||||
* @param width The width of the block.
|
||||
* @param markerOffset The offset of the marker from around the block.
|
||||
* @param markerHeight The height of the marker.
|
||||
@@ -496,6 +515,7 @@ export class MarkerSvg {
|
||||
/**
|
||||
* Move and show the marker at the specified coordinate in workspace units.
|
||||
* Displays a filled in rectangle.
|
||||
*
|
||||
* @param x The new x, in workspace units.
|
||||
* @param y The new y, in workspace units.
|
||||
* @param width The new width, in workspace units.
|
||||
@@ -519,6 +539,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Flip the SVG paths in RTL.
|
||||
*
|
||||
* @param markerSvg The marker that we want to flip.
|
||||
*/
|
||||
private flipRtl_(markerSvg: SVGElement) {
|
||||
@@ -535,6 +556,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Fire event for the marker or marker.
|
||||
*
|
||||
* @param oldNode The old node the marker used to be on.
|
||||
* @param curNode The new node the marker is currently on.
|
||||
*/
|
||||
@@ -547,7 +569,8 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Get the properties to make a marker blink.
|
||||
* @return The object holding attributes to make the marker blink.
|
||||
*
|
||||
* @returns The object holding attributes to make the marker blink.
|
||||
*/
|
||||
protected getBlinkProperties_(): AnyDuringMigration {
|
||||
return {
|
||||
@@ -561,7 +584,8 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Create the marker SVG.
|
||||
* @return The SVG node created.
|
||||
*
|
||||
* @returns The SVG node created.
|
||||
*/
|
||||
protected createDomInternal_(): Element {
|
||||
/* This markup will be generated and added to the .svgGroup_:
|
||||
@@ -655,6 +679,7 @@ export class MarkerSvg {
|
||||
|
||||
/**
|
||||
* Apply the marker's colour.
|
||||
*
|
||||
* @param _curNode The node that we want to draw the marker for.
|
||||
*/
|
||||
protected applyColour_(_curNode: ASTNode) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object that owns a block's rendering SVG elements.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that owns a block's rendering SVG elements.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -32,6 +29,7 @@ import type {IPathObject} from './i_path_object.js';
|
||||
/**
|
||||
* An object that handles creating and setting each of the SVG elements
|
||||
* used by the renderer.
|
||||
*
|
||||
* @alias Blockly.blockRendering.PathObject
|
||||
*/
|
||||
export class PathObject implements IPathObject {
|
||||
@@ -42,6 +40,7 @@ export class PathObject implements IPathObject {
|
||||
/**
|
||||
* Holds the cursors svg element when the cursor is attached to the block.
|
||||
* This is null if there is no cursor on the block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
// AnyDuringMigration because: Type 'null' is not assignable to type
|
||||
@@ -51,6 +50,7 @@ export class PathObject implements IPathObject {
|
||||
/**
|
||||
* Holds the markers svg element when the marker is attached to the block.
|
||||
* This is null if there is no marker on the block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
// AnyDuringMigration because: Type 'null' is not assignable to type
|
||||
@@ -81,6 +81,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Set the path generated by the renderer onto the respective SVG element.
|
||||
*
|
||||
* @param pathString The path.
|
||||
* @internal
|
||||
*/
|
||||
@@ -90,6 +91,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Flip the SVG paths in RTL.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
flipRTL() {
|
||||
@@ -99,6 +101,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Add the cursor SVG to this block's SVG group.
|
||||
*
|
||||
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
@@ -117,6 +120,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Add the marker SVG to this block's SVG group.
|
||||
*
|
||||
* @param markerSvg The SVG root of the marker to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
@@ -140,6 +144,7 @@ export class PathObject implements IPathObject {
|
||||
/**
|
||||
* Apply the stored colours to the block's path, taking into account whether
|
||||
* the paths belong to a shadow block.
|
||||
*
|
||||
* @param block The source block.
|
||||
* @internal
|
||||
*/
|
||||
@@ -153,6 +158,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Set the style.
|
||||
*
|
||||
* @param blockStyle The block style to use.
|
||||
* @internal
|
||||
*/
|
||||
@@ -162,6 +168,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove the given CSS class on the path object's root SVG element.
|
||||
*
|
||||
* @param className The name of the class to add or remove
|
||||
* @param add True if the class should be added. False if it should be
|
||||
* removed.
|
||||
@@ -177,6 +184,7 @@ export class PathObject implements IPathObject {
|
||||
/**
|
||||
* Set whether the block shows a highlight or not. Block highlighting is
|
||||
* often used to visually mark blocks currently being executed.
|
||||
*
|
||||
* @param enable True if highlighted.
|
||||
* @internal
|
||||
*/
|
||||
@@ -191,6 +199,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Updates the look of the block to reflect a shadow state.
|
||||
*
|
||||
* @param shadow True if the block is a shadow block.
|
||||
*/
|
||||
protected updateShadow_(shadow: boolean) {
|
||||
@@ -202,6 +211,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Updates the look of the block to reflect a disabled state.
|
||||
*
|
||||
* @param disabled True if disabled.
|
||||
*/
|
||||
protected updateDisabled_(disabled: boolean) {
|
||||
@@ -214,6 +224,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is selected.
|
||||
*
|
||||
* @param enable True if selection is enabled, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
@@ -223,6 +234,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is dragged over a delete area.
|
||||
*
|
||||
* @param enable True if the block is being dragged over a delete area, false
|
||||
* otherwise.
|
||||
* @internal
|
||||
@@ -233,6 +245,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is an insertion marker.
|
||||
*
|
||||
* @param enable True if the block is an insertion marker, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
@@ -242,6 +255,7 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Add or remove styling showing that a block is movable.
|
||||
*
|
||||
* @param enable True if the block is movable, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
@@ -253,6 +267,7 @@ export class PathObject implements IPathObject {
|
||||
* Add or remove styling that shows that if the dragging block is dropped,
|
||||
* this block will be replaced. If a shadow block, it will disappear.
|
||||
* Otherwise it will bump.
|
||||
*
|
||||
* @param enable True if styling should be added.
|
||||
* @internal
|
||||
*/
|
||||
@@ -263,6 +278,7 @@ export class PathObject implements IPathObject {
|
||||
/**
|
||||
* Add or remove styling that shows that if the dragging block is dropped,
|
||||
* this block will be connected to the input.
|
||||
*
|
||||
* @param _conn The connection on the input to highlight.
|
||||
* @param _enable True if styling should be added.
|
||||
* @internal
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Base renderer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -38,6 +35,7 @@ import {PathObject} from './path_object.js';
|
||||
|
||||
/**
|
||||
* The base class for a block renderer.
|
||||
*
|
||||
* @alias Blockly.blockRendering.Renderer
|
||||
*/
|
||||
export class Renderer implements IRegistrable {
|
||||
@@ -49,6 +47,7 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Rendering constant overrides, passed in through options.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
overrides: object|null = null;
|
||||
@@ -63,7 +62,8 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Gets the class name that identifies this renderer.
|
||||
* @return The CSS class name.
|
||||
*
|
||||
* @returns The CSS class name.
|
||||
* @internal
|
||||
*/
|
||||
getClassName(): string {
|
||||
@@ -72,6 +72,7 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Initialize the renderer.
|
||||
*
|
||||
* @param theme The workspace theme object.
|
||||
* @param opt_rendererOverrides Rendering constant overrides.
|
||||
* @internal
|
||||
@@ -88,6 +89,7 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create any DOM elements that this renderer needs.
|
||||
*
|
||||
* @param svg The root of the workspace's SVG.
|
||||
* @param theme The workspace theme object.
|
||||
* @internal
|
||||
@@ -100,6 +102,7 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Refresh the renderer after a theme change.
|
||||
*
|
||||
* @param svg The root of the workspace's SVG.
|
||||
* @param theme The workspace theme object.
|
||||
* @internal
|
||||
@@ -121,6 +124,7 @@ export class Renderer implements IRegistrable {
|
||||
/**
|
||||
* Dispose of this renderer.
|
||||
* Delete all DOM elements that this renderer and its constants created.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
dispose() {
|
||||
@@ -131,7 +135,8 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's constant provider.
|
||||
* @return The constant provider.
|
||||
*
|
||||
* @returns The constant provider.
|
||||
*/
|
||||
protected makeConstants_(): ConstantProvider {
|
||||
return new ConstantProvider();
|
||||
@@ -139,8 +144,9 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's render info object.
|
||||
*
|
||||
* @param block The block to measure.
|
||||
* @return The render info object.
|
||||
* @returns The render info object.
|
||||
*/
|
||||
protected makeRenderInfo_(block: BlockSvg): RenderInfo {
|
||||
return new RenderInfo(this, block);
|
||||
@@ -148,10 +154,11 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's drawer.
|
||||
*
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @return The drawer.
|
||||
* @returns The drawer.
|
||||
*/
|
||||
protected makeDrawer_(block: BlockSvg, info: RenderInfo): Drawer {
|
||||
return new Drawer(block, info);
|
||||
@@ -159,7 +166,8 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's debugger.
|
||||
* @return The renderer debugger.
|
||||
*
|
||||
* @returns The renderer debugger.
|
||||
* @suppress {strictModuleDepCheck} Debug renderer only included in
|
||||
* playground.
|
||||
*/
|
||||
@@ -169,9 +177,10 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's marker drawer.
|
||||
*
|
||||
* @param workspace The workspace the marker belongs to.
|
||||
* @param marker The marker.
|
||||
* @return The object in charge of drawing the marker.
|
||||
* @returns The object in charge of drawing the marker.
|
||||
* @internal
|
||||
*/
|
||||
makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker): MarkerSvg {
|
||||
@@ -180,9 +189,10 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create a new instance of a renderer path object.
|
||||
*
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @return The renderer path object.
|
||||
* @returns The renderer path object.
|
||||
* @internal
|
||||
*/
|
||||
makePathObject(root: SVGElement, style: BlockStyle): IPathObject {
|
||||
@@ -192,7 +202,8 @@ export class Renderer implements IRegistrable {
|
||||
/**
|
||||
* Get the current renderer's constant provider. We assume that when this is
|
||||
* called, the renderer has already been initialized.
|
||||
* @return The constant provider.
|
||||
*
|
||||
* @returns The constant provider.
|
||||
* @internal
|
||||
*/
|
||||
getConstants(): ConstantProvider {
|
||||
@@ -201,8 +212,9 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Determine whether or not to highlight a connection.
|
||||
*
|
||||
* @param _conn The connection to determine whether or not to highlight.
|
||||
* @return True if we should highlight the connection.
|
||||
* @returns True if we should highlight the connection.
|
||||
* @internal
|
||||
*/
|
||||
shouldHighlightConnection(_conn: Connection): boolean {
|
||||
@@ -214,11 +226,12 @@ export class Renderer implements IRegistrable {
|
||||
* block-clump. If the clump is a row the end is the last input. If the clump
|
||||
* is a stack, the end is the last next connection. If the clump is neither,
|
||||
* then this returns false.
|
||||
*
|
||||
* @param topBlock The top block of the block clump we want to try and connect
|
||||
* to.
|
||||
* @param orphanBlock The orphan block that wants to find a home.
|
||||
* @param localType The type of the connection being dragged.
|
||||
* @return Whether there is a home for the orphan or not.
|
||||
* @returns Whether there is a home for the orphan or not.
|
||||
* @internal
|
||||
*/
|
||||
orphanCanConnectAtEnd(
|
||||
@@ -233,10 +246,11 @@ export class Renderer implements IRegistrable {
|
||||
/**
|
||||
* Chooses a connection preview method based on the available connection, the
|
||||
* current dragged connection, and the block being dragged.
|
||||
*
|
||||
* @param closest The available connection.
|
||||
* @param local The connection currently being dragged.
|
||||
* @param topBlock The block currently being dragged.
|
||||
* @return The preview type to display.
|
||||
* @returns The preview type to display.
|
||||
* @internal
|
||||
*/
|
||||
getConnectionPreviewMethod(
|
||||
@@ -257,6 +271,7 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Render the block.
|
||||
*
|
||||
* @param block The block to render.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object that provides constants for rendering blocks in Geras
|
||||
* mode.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in Geras
|
||||
* mode.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -22,6 +18,7 @@ import {ConstantProvider as BaseConstantProvider} from '../common/constants.js';
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in Geras mode.
|
||||
*
|
||||
* @alias Blockly.geras.ConstantProvider
|
||||
*/
|
||||
export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Renderer that preserves the look and feel of Blockly pre-2019.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Renderer that preserves the look and feel of Blockly pre-2019.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -30,6 +27,7 @@ import type {PathObject} from './path_object.js';
|
||||
|
||||
/**
|
||||
* An object that draws a block based on the given rendering information.
|
||||
*
|
||||
* @alias Blockly.geras.Drawer
|
||||
*/
|
||||
export class Drawer extends BaseDrawer {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** @fileoverview Re-exports of Blockly.geras.* modules. */
|
||||
/** @file Re-exports of Blockly.geras.* modules. */
|
||||
|
||||
/**
|
||||
* @license
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.geras.* modules.
|
||||
*
|
||||
* @namespace Blockly.geras
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects for rendering highlights on blocks.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects for rendering highlights on blocks.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -67,6 +64,7 @@ export interface JaggedTeeth {
|
||||
* Some highlights are simple offsets of the parent paths and can be generated
|
||||
* programmatically. Others, especially on curves, are just made out of piles
|
||||
* of constants and are hard to tweak.
|
||||
*
|
||||
* @alias Blockly.geras.HighlightConstantProvider
|
||||
*/
|
||||
export class HighlightConstantProvider {
|
||||
@@ -98,6 +96,7 @@ export class HighlightConstantProvider {
|
||||
|
||||
/**
|
||||
* The start point, which is offset in both X and Y, as an SVG path chunk.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
this.START_POINT = svgPaths.moveBy(this.OFFSET, this.OFFSET);
|
||||
@@ -105,6 +104,7 @@ export class HighlightConstantProvider {
|
||||
|
||||
/**
|
||||
* Initialize shape objects based on the constants set in the constructor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
init() {
|
||||
@@ -145,7 +145,7 @@ export class HighlightConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about inside
|
||||
* @returns An object containing sizing and path information about inside
|
||||
* corner highlights.
|
||||
* @internal
|
||||
*/
|
||||
@@ -189,7 +189,7 @@ export class HighlightConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about outside
|
||||
* @returns An object containing sizing and path information about outside
|
||||
* corner highlights.
|
||||
* @internal
|
||||
*/
|
||||
@@ -238,7 +238,7 @@ export class HighlightConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about puzzle tab
|
||||
* @returns An object containing sizing and path information about puzzle tab
|
||||
* highlights.
|
||||
* @internal
|
||||
*/
|
||||
@@ -288,7 +288,7 @@ export class HighlightConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about notch
|
||||
* @returns An object containing sizing and path information about notch
|
||||
* highlights.
|
||||
* @internal
|
||||
*/
|
||||
@@ -300,7 +300,7 @@ export class HighlightConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about collapsed
|
||||
* @returns An object containing sizing and path information about collapsed
|
||||
* block edge highlights.
|
||||
* @internal
|
||||
*/
|
||||
@@ -311,7 +311,7 @@ export class HighlightConstantProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object containing sizing and path information about start
|
||||
* @returns An object containing sizing and path information about start
|
||||
* highlights.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Methods for adding highlights on block, for rendering in
|
||||
* compatibility mode.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for adding highlights on block, for rendering in
|
||||
* compatibility mode.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -44,6 +40,7 @@ import type {InlineInput} from './measurables/inline_input.js';
|
||||
* position of each part of the block. The resulting paths are not continuous
|
||||
* or closed paths. The highlights for tabs and notches are loosely based on
|
||||
* tab and notch shapes, but are not exactly the same.
|
||||
*
|
||||
* @alias Blockly.geras.Highlighter
|
||||
*/
|
||||
export class Highlighter {
|
||||
@@ -90,7 +87,8 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Get the steps for the highlight path.
|
||||
* @return The steps for the highlight path.
|
||||
*
|
||||
* @returns The steps for the highlight path.
|
||||
* @internal
|
||||
*/
|
||||
getPath(): string {
|
||||
@@ -99,6 +97,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Add a highlight to the top corner of a block.
|
||||
*
|
||||
* @param row The top row of the block.
|
||||
* @internal
|
||||
*/
|
||||
@@ -129,6 +128,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Add a highlight on a jagged edge for a collapsed block.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
@@ -143,6 +143,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Add a highlight on a value input.
|
||||
*
|
||||
* @param row The row the input belongs to.
|
||||
* @internal
|
||||
*/
|
||||
@@ -164,6 +165,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Add a highlight on a statement input.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
@@ -187,6 +189,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Add a highlight on the right side of a row.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
@@ -206,6 +209,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Add a highlight to the bottom row.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
@@ -230,6 +234,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Draw the highlight on the left side of the block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
drawLeft() {
|
||||
@@ -263,6 +268,7 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Add a highlight to an inline input.
|
||||
*
|
||||
* @param input The input to highlight.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Old (compatibility) renderer.
|
||||
* Geras: spirit of old age.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Old (compatibility) renderer.
|
||||
* Geras: spirit of old age.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -43,6 +39,7 @@ import type {Renderer} from './renderer.js';
|
||||
* This measure pass does not propagate changes to the block (although fields
|
||||
* may choose to rerender when getSize() is called). However, calling it
|
||||
* repeatedly may be expensive.
|
||||
*
|
||||
* @alias Blockly.geras.RenderInfo
|
||||
*/
|
||||
export class RenderInfo extends BaseRenderInfo {
|
||||
@@ -63,7 +60,8 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
|
||||
/**
|
||||
* Get the block renderer in use.
|
||||
* @return The block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing inline inputs with connections on a
|
||||
* rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing inline inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
@@ -27,6 +23,7 @@ import type {ConstantProvider as GerasConstantProvider} from '../constants.js';
|
||||
/**
|
||||
* An object containing information about the space an inline input takes up
|
||||
* during rendering.
|
||||
*
|
||||
* @alias Blockly.geras.InlineInput
|
||||
*/
|
||||
export class InlineInput extends BaseInlineInput {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing statement inputs with connections on a
|
||||
* rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing statement inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
@@ -27,6 +23,7 @@ import type {ConstantProvider as GerasConstantProvider} from '../constants.js';
|
||||
/**
|
||||
* An object containing information about the space a statement input takes up
|
||||
* during rendering.
|
||||
*
|
||||
* @alias Blockly.geras.StatementInput
|
||||
*/
|
||||
export class StatementInput extends BaseStatementInput {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object that owns a block's rendering SVG elements.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that owns a block's rendering SVG elements.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -32,6 +29,7 @@ import type {ConstantProvider} from './constants.js';
|
||||
/**
|
||||
* An object that handles creating and setting each of the SVG elements
|
||||
* used by the renderer.
|
||||
*
|
||||
* @alias Blockly.geras.PathObject
|
||||
*/
|
||||
export class PathObject extends BasePathObject {
|
||||
@@ -42,6 +40,7 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* The colour of the dark path on the block in '#RRGGBB' format.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
colourDark = '#000000';
|
||||
@@ -78,6 +77,7 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* Set the highlight path generated by the renderer onto the SVG element.
|
||||
*
|
||||
* @param highlightPath The highlight path.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Geras renderer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Geras renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -34,6 +31,7 @@ import {PathObject} from './path_object.js';
|
||||
|
||||
/**
|
||||
* The geras renderer.
|
||||
*
|
||||
* @alias Blockly.geras.Renderer
|
||||
*/
|
||||
export class Renderer extends BaseRenderer {
|
||||
@@ -54,6 +52,7 @@ export class Renderer extends BaseRenderer {
|
||||
/**
|
||||
* Initialize the renderer. Geras has a highlight provider in addition to
|
||||
* the normal constant provider.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
override init(theme: Theme, opt_rendererOverrides: AnyDuringMigration) {
|
||||
@@ -73,8 +72,9 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's render info object.
|
||||
*
|
||||
* @param block The block to measure.
|
||||
* @return The render info object.
|
||||
* @returns The render info object.
|
||||
*/
|
||||
protected override makeRenderInfo_(block: BlockSvg): RenderInfo {
|
||||
return new RenderInfo(this, block);
|
||||
@@ -82,10 +82,11 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's drawer.
|
||||
*
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @return The drawer.
|
||||
* @returns The drawer.
|
||||
*/
|
||||
protected override makeDrawer_(block: BlockSvg, info: BaseRenderInfo):
|
||||
Drawer {
|
||||
@@ -94,9 +95,10 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of a renderer path object.
|
||||
*
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @return The renderer path object.
|
||||
* @returns The renderer path object.
|
||||
* @internal
|
||||
*/
|
||||
override makePathObject(root: SVGElement, style: BlockStyle): PathObject {
|
||||
@@ -106,7 +108,8 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's highlight constant provider.
|
||||
* @return The highlight constant provider.
|
||||
*
|
||||
* @returns The highlight constant provider.
|
||||
*/
|
||||
protected makeHighlightConstants_(): HighlightConstantProvider {
|
||||
return new HighlightConstantProvider((this.getConstants()));
|
||||
@@ -115,7 +118,8 @@ export class Renderer extends BaseRenderer {
|
||||
/**
|
||||
* Get the renderer's highlight constant provider. We assume that when this
|
||||
* is called, the renderer has already been initialized.
|
||||
* @return The highlight constant provider.
|
||||
*
|
||||
* @returns The highlight constant provider.
|
||||
* @internal
|
||||
*/
|
||||
getHighlightConstants(): HighlightConstantProvider {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Methods for graphically rendering a block as SVG.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a block as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import {Types} from './types.js';
|
||||
* The base class to represent a part of a block that takes up space during
|
||||
* rendering. The constructor for each non-spacer Measurable records the size
|
||||
* of the block element (e.g. field, statement input).
|
||||
*
|
||||
* @alias Blockly.blockRendering.Measurable
|
||||
*/
|
||||
export class Measurable {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Object representing a bottom row on a rendered block.
|
||||
* of its subcomponents.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a bottom row on a rendered block.
|
||||
* of its subcomponents.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -30,18 +26,20 @@ import {Types} from './types.js';
|
||||
* a block as well as spacing information for the bottom row.
|
||||
* Elements in a bottom row can consist of corners, spacers and next
|
||||
* connections.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.BottomRow
|
||||
*/
|
||||
export class BottomRow extends Row {
|
||||
/**
|
||||
* Whether this row has a next connection.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
hasNextConnection = false;
|
||||
|
||||
/**
|
||||
* The next connection on the row, if any.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
connection: NextConnection|null = null;
|
||||
@@ -50,6 +48,7 @@ export class BottomRow extends Row {
|
||||
* The amount that the bottom of the block extends below the horizontal
|
||||
* edge, e.g. because of a next connection. Must be non-negative (see
|
||||
* #2820).
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
descenderHeight = 0;
|
||||
@@ -71,8 +70,9 @@ export class BottomRow extends Row {
|
||||
|
||||
/**
|
||||
* Returns whether or not the bottom row has a left square corner.
|
||||
*
|
||||
* @param block The block whose bottom row this represents.
|
||||
* @return Whether or not the bottom row has a left square corner.
|
||||
* @returns Whether or not the bottom row has a left square corner.
|
||||
*/
|
||||
hasLeftSquareCorner(block: BlockSvg): boolean {
|
||||
return !!block.outputConnection || !!block.getNextBlock();
|
||||
@@ -80,8 +80,9 @@ export class BottomRow extends Row {
|
||||
|
||||
/**
|
||||
* Returns whether or not the bottom row has a right square corner.
|
||||
*
|
||||
* @param _block The block whose bottom row this represents.
|
||||
* @return Whether or not the bottom row has a right square corner.
|
||||
* @returns Whether or not the bottom row has a right square corner.
|
||||
*/
|
||||
hasRightSquareCorner(_block: BlockSvg): boolean {
|
||||
return true;
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Base class representing the space a connection takes up during
|
||||
* rendering.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class representing the space a connection takes up during
|
||||
* rendering.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -28,6 +24,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* The base class to represent a connection and the space that it takes up on
|
||||
* the block.
|
||||
*
|
||||
* @alias Blockly.blockRendering.Connection
|
||||
*/
|
||||
export class Connection extends Measurable {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class representing external value inputs with connections on a
|
||||
* rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing external value inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -28,7 +24,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space an external value input
|
||||
* takes up during rendering
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.ExternalValueInput
|
||||
*/
|
||||
export class ExternalValueInput extends InputConnection {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing a field in a row of a rendered
|
||||
* block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a field in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -29,7 +25,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space a field takes up during
|
||||
* rendering
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.Field
|
||||
*/
|
||||
export class Field extends Measurable {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing a hat in a row of a rendered
|
||||
* block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a hat in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -26,7 +22,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space a hat takes up during
|
||||
* rendering.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.Hat
|
||||
*/
|
||||
export class Hat extends Measurable {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing an icon in a row of a rendered
|
||||
* block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing an icon in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -28,7 +24,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space an icon takes up during
|
||||
* rendering
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.Icon
|
||||
*/
|
||||
export class Icon extends Measurable {
|
||||
@@ -37,6 +33,7 @@ export class Icon extends Measurable {
|
||||
/**
|
||||
* An object containing information about the space an icon takes up during
|
||||
* rendering
|
||||
*
|
||||
* @param constants The rendering constants provider.
|
||||
* @param icon The icon to measure and store information for.
|
||||
* @internal
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing a spacer in a row of a rendered
|
||||
* block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a spacer in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -26,7 +22,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about a spacer between two elements on a
|
||||
* row.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.InRowSpacer
|
||||
*/
|
||||
export class InRowSpacer extends Measurable {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class representing inline inputs with connections on a rendered
|
||||
* block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing inline inputs with connections on a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -28,7 +24,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space an inline input takes up
|
||||
* during rendering
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.InlineInput
|
||||
*/
|
||||
export class InlineInput extends InputConnection {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class representing inputs with connections on a rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing inputs with connections on a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -27,6 +24,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* The base class to represent an input that takes up space on a block
|
||||
* during rendering
|
||||
*
|
||||
* @alias Blockly.blockRendering.InputConnection
|
||||
*/
|
||||
export class InputConnection extends Connection {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Object representing a row that holds one or more inputs on a
|
||||
* rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a row that holds one or more inputs on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -28,12 +24,13 @@ import {Types} from './types.js';
|
||||
|
||||
/**
|
||||
* An object containing information about a row that holds one or more inputs.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.InputRow
|
||||
*/
|
||||
export class InputRow extends Row {
|
||||
/**
|
||||
* The total width of all blocks connected to this row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
connectedBlockWidths = 0;
|
||||
@@ -49,6 +46,7 @@ export class InputRow extends Row {
|
||||
|
||||
/**
|
||||
* Inspect all subcomponents and populate all size properties on the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
override measure() {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing a jagged edge in a row of a rendered
|
||||
* block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a jagged edge in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -26,7 +22,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the jagged edge of a collapsed block
|
||||
* takes up during rendering
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.JaggedEdge
|
||||
*/
|
||||
export class JaggedEdge extends Measurable {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class representing the space a next connection takes up during
|
||||
* rendering.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing the space a next connection takes up during
|
||||
* rendering.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -27,7 +23,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space a next connection takes
|
||||
* up during rendering.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.NextConnection
|
||||
*/
|
||||
export class NextConnection extends Connection {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* 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
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -27,7 +23,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space an output connection takes
|
||||
* up during rendering.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.OutputConnection
|
||||
*/
|
||||
export class OutputConnection extends Connection {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class representing the space a previous connection takes up
|
||||
* during rendering.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing the space a previous connection takes up
|
||||
* during rendering.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -27,7 +23,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space a previous connection takes
|
||||
* up during rendering.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.PreviousConnection
|
||||
*/
|
||||
export class PreviousConnection extends Connection {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Objects representing a round corner in a row of a rendered
|
||||
* block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a round corner in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -26,7 +22,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space a rounded corner takes up
|
||||
* during rendering.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.RoundCorner
|
||||
*/
|
||||
export class RoundCorner extends Measurable {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Object representing a single row on a rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a single row on a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -26,6 +23,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object representing a single row on a rendered block and all of its
|
||||
* subcomponents.
|
||||
*
|
||||
* @alias Blockly.blockRendering.Row
|
||||
*/
|
||||
export class Row {
|
||||
@@ -34,12 +32,14 @@ export class Row {
|
||||
|
||||
/**
|
||||
* An array of elements contained in this row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
elements: Measurable[] = [];
|
||||
|
||||
/**
|
||||
* The height of the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
height = 0;
|
||||
@@ -47,12 +47,14 @@ export class Row {
|
||||
/**
|
||||
* The width of the row, from the left edge of the block to the right.
|
||||
* Does not include child blocks unless they are inline.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
width = 0;
|
||||
|
||||
/**
|
||||
* The minimum height of the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
minHeight = 0;
|
||||
@@ -60,6 +62,7 @@ export class Row {
|
||||
/**
|
||||
* The minimum width of the row, from the left edge of the block to the
|
||||
* right. Does not include child blocks unless they are inline.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
minWidth = 0;
|
||||
@@ -67,6 +70,7 @@ export class Row {
|
||||
/**
|
||||
* The width of the row, from the left edge of the block to the edge of the
|
||||
* block or any connected child blocks.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
widthWithConnectedBlocks = 0;
|
||||
@@ -74,6 +78,7 @@ export class Row {
|
||||
/**
|
||||
* The Y position of the row relative to the origin of the block's svg
|
||||
* group.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
yPos = 0;
|
||||
@@ -81,18 +86,21 @@ export class Row {
|
||||
/**
|
||||
* The X position of the row relative to the origin of the block's svg
|
||||
* group.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
xPos = 0;
|
||||
|
||||
/**
|
||||
* Whether the row has any external inputs.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
hasExternalInput = false;
|
||||
|
||||
/**
|
||||
* Whether the row has any statement inputs.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
hasStatement = false;
|
||||
@@ -106,18 +114,21 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Whether the row has any inline inputs.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
hasInlineInput = false;
|
||||
|
||||
/**
|
||||
* Whether the row has any dummy inputs.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
hasDummyInput = false;
|
||||
|
||||
/**
|
||||
* Whether the row has a jagged edge.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
hasJaggedEdge = false;
|
||||
@@ -125,6 +136,7 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Alignment of the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
align: number|null = null;
|
||||
@@ -147,7 +159,8 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Get the last input on this row, if it has one.
|
||||
* @return The last input on the row, or null.
|
||||
*
|
||||
* @returns The last input on the row, or null.
|
||||
* @internal
|
||||
*/
|
||||
getLastInput(): InputConnection {
|
||||
@@ -165,6 +178,7 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Inspect all subcomponents and populate all size properties on the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
measure() {
|
||||
@@ -173,7 +187,8 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Determines whether this row should start with an element spacer.
|
||||
* @return Whether the row should start with a spacer.
|
||||
*
|
||||
* @returns Whether the row should start with a spacer.
|
||||
* @internal
|
||||
*/
|
||||
startsWithElemSpacer(): boolean {
|
||||
@@ -182,7 +197,8 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Determines whether this row should end with an element spacer.
|
||||
* @return Whether the row should end with a spacer.
|
||||
*
|
||||
* @returns Whether the row should end with a spacer.
|
||||
* @internal
|
||||
*/
|
||||
endsWithElemSpacer(): boolean {
|
||||
@@ -191,7 +207,8 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Convenience method to get the first spacer element on this row.
|
||||
* @return The first spacer element on this row.
|
||||
*
|
||||
* @returns The first spacer element on this row.
|
||||
* @internal
|
||||
*/
|
||||
getFirstSpacer(): InRowSpacer {
|
||||
@@ -208,7 +225,8 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Convenience method to get the last spacer element on this row.
|
||||
* @return The last spacer element on this row.
|
||||
*
|
||||
* @returns The last spacer element on this row.
|
||||
* @internal
|
||||
*/
|
||||
getLastSpacer(): InRowSpacer {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Object representing a spacer between two rows.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a spacer between two rows.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -24,7 +21,7 @@ import {Types} from './types.js';
|
||||
|
||||
/**
|
||||
* An object containing information about a spacer between two rows.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.SpacerRow
|
||||
*/
|
||||
export class SpacerRow extends Row {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* 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
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -26,7 +22,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space a square corner takes up
|
||||
* during rendering.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.SquareCorner
|
||||
*/
|
||||
export class SquareCorner extends Measurable {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Class representing statement inputs with connections on a
|
||||
* rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing statement inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -28,7 +24,7 @@ import {Types} from './types.js';
|
||||
/**
|
||||
* An object containing information about the space a statement input takes up
|
||||
* during rendering
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.StatementInput
|
||||
*/
|
||||
export class StatementInput extends InputConnection {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Object representing a top row on a rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a top row on a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -31,7 +28,7 @@ import {Types} from './types.js';
|
||||
* connections.
|
||||
* After this constructor is called, the row will contain all non-spacer
|
||||
* elements it needs.
|
||||
* @struct
|
||||
*
|
||||
* @alias Blockly.blockRendering.TopRow
|
||||
*/
|
||||
export class TopRow extends Row {
|
||||
@@ -39,6 +36,7 @@ export class TopRow extends Row {
|
||||
* The starting point for drawing the row, in the y direction.
|
||||
* This allows us to draw hats and similar shapes that don't start at the
|
||||
* origin. Must be non-negative (see #2820).
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
capline = 0;
|
||||
@@ -65,8 +63,9 @@ export class TopRow extends Row {
|
||||
|
||||
/**
|
||||
* Returns whether or not the top row has a left square corner.
|
||||
*
|
||||
* @param block The block whose top row this represents.
|
||||
* @return Whether or not the top row has a left square corner.
|
||||
* @returns Whether or not the top row has a left square corner.
|
||||
* @internal
|
||||
*/
|
||||
hasLeftSquareCorner(block: BlockSvg): boolean {
|
||||
@@ -81,8 +80,9 @@ export class TopRow extends Row {
|
||||
|
||||
/**
|
||||
* Returns whether or not the top row has a right square corner.
|
||||
*
|
||||
* @param _block The block whose top row this represents.
|
||||
* @return Whether or not the top row has a right square corner.
|
||||
* @returns Whether or not the top row has a right square corner.
|
||||
*/
|
||||
hasRightSquareCorner(_block: BlockSvg): boolean {
|
||||
return true;
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Measurable types.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Measurable types.
|
||||
*
|
||||
* @namespace Blockly.blockRendering.Types
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -21,6 +18,7 @@ import type {Row} from './row.js';
|
||||
|
||||
/**
|
||||
* Types of rendering elements.
|
||||
*
|
||||
* @alias Blockly.blockRendering.Types
|
||||
*/
|
||||
class TypesContainer {
|
||||
@@ -54,12 +52,14 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* A Left Corner Union Type.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
LEFT_CORNER = this.LEFT_SQUARE_CORNER | this.LEFT_ROUND_CORNER;
|
||||
|
||||
/**
|
||||
* A Right Corner Union Type.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
RIGHT_CORNER = this.RIGHT_SQUARE_CORNER | this.RIGHT_ROUND_CORNER;
|
||||
@@ -74,8 +74,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Get the enum flag value of an existing type or register a new type.
|
||||
*
|
||||
* @param type The name of the type.
|
||||
* @return The enum flag value associated with that type.
|
||||
* @returns The enum flag value associated with that type.
|
||||
* @internal
|
||||
*/
|
||||
getType(type: string): number {
|
||||
@@ -88,8 +89,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a field.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a field.
|
||||
* @returns 1 if the object stores information about a field.
|
||||
* @internal
|
||||
*/
|
||||
isField(elem: Measurable): number {
|
||||
@@ -98,8 +100,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a hat.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a hat.
|
||||
* @returns 1 if the object stores information about a hat.
|
||||
* @internal
|
||||
*/
|
||||
isHat(elem: Measurable): number {
|
||||
@@ -108,8 +111,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about an icon.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about an icon.
|
||||
* @returns 1 if the object stores information about an icon.
|
||||
* @internal
|
||||
*/
|
||||
isIcon(elem: Measurable): number {
|
||||
@@ -118,8 +122,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a spacer.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a spacer.
|
||||
* @returns 1 if the object stores information about a spacer.
|
||||
* @internal
|
||||
*/
|
||||
isSpacer(elem: Measurable|Row): number {
|
||||
@@ -128,8 +133,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about an in-row spacer.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about an in-row spacer.
|
||||
* @returns 1 if the object stores information about an in-row spacer.
|
||||
* @internal
|
||||
*/
|
||||
isInRowSpacer(elem: Measurable): number {
|
||||
@@ -138,8 +144,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about an input.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about an input.
|
||||
* @returns 1 if the object stores information about an input.
|
||||
* @internal
|
||||
*/
|
||||
isInput(elem: Measurable): number {
|
||||
@@ -148,8 +155,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about an external input.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about an external input.
|
||||
* @returns 1 if the object stores information about an external input.
|
||||
* @internal
|
||||
*/
|
||||
isExternalInput(elem: Measurable): number {
|
||||
@@ -158,8 +166,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about an inline input.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about an inline input.
|
||||
* @returns 1 if the object stores information about an inline input.
|
||||
* @internal
|
||||
*/
|
||||
isInlineInput(elem: Measurable): number {
|
||||
@@ -168,8 +177,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a statement input.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a statement input.
|
||||
* @returns 1 if the object stores information about a statement input.
|
||||
* @internal
|
||||
*/
|
||||
isStatementInput(elem: Measurable): number {
|
||||
@@ -178,8 +188,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a previous connection.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a previous connection.
|
||||
* @returns 1 if the object stores information about a previous connection.
|
||||
* @internal
|
||||
*/
|
||||
isPreviousConnection(elem: Measurable): number {
|
||||
@@ -188,8 +199,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a next connection.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a next connection.
|
||||
* @returns 1 if the object stores information about a next connection.
|
||||
* @internal
|
||||
*/
|
||||
isNextConnection(elem: Measurable): number {
|
||||
@@ -199,8 +211,9 @@ class TypesContainer {
|
||||
/**
|
||||
* Whether a measurable stores information about a previous or next
|
||||
* connection.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a previous or next
|
||||
* @returns 1 if the object stores information about a previous or next
|
||||
* connection.
|
||||
* @internal
|
||||
*/
|
||||
@@ -210,8 +223,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a left round corner.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a left round corner.
|
||||
* @returns 1 if the object stores information about a left round corner.
|
||||
* @internal
|
||||
*/
|
||||
isLeftRoundedCorner(elem: Measurable): number {
|
||||
@@ -220,8 +234,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a right round corner.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a right round corner.
|
||||
* @returns 1 if the object stores information about a right round corner.
|
||||
* @internal
|
||||
*/
|
||||
isRightRoundedCorner(elem: Measurable): number {
|
||||
@@ -230,8 +245,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a left square corner.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a left square corner.
|
||||
* @returns 1 if the object stores information about a left square corner.
|
||||
* @internal
|
||||
*/
|
||||
isLeftSquareCorner(elem: Measurable): number {
|
||||
@@ -240,8 +256,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a right square corner.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a right square corner.
|
||||
* @returns 1 if the object stores information about a right square corner.
|
||||
* @internal
|
||||
*/
|
||||
isRightSquareCorner(elem: Measurable): number {
|
||||
@@ -250,8 +267,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a corner.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a corner.
|
||||
* @returns 1 if the object stores information about a corner.
|
||||
* @internal
|
||||
*/
|
||||
isCorner(elem: Measurable): number {
|
||||
@@ -260,8 +278,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a jagged edge.
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @return 1 if the object stores information about a jagged edge.
|
||||
* @returns 1 if the object stores information about a jagged edge.
|
||||
* @internal
|
||||
*/
|
||||
isJaggedEdge(elem: Measurable): number {
|
||||
@@ -270,8 +289,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a row.
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @return 1 if the object stores information about a row.
|
||||
* @returns 1 if the object stores information about a row.
|
||||
* @internal
|
||||
*/
|
||||
isRow(row: Row): number {
|
||||
@@ -280,8 +300,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a between-row spacer.
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @return 1 if the object stores information about a between-row spacer.
|
||||
* @returns 1 if the object stores information about a between-row spacer.
|
||||
* @internal
|
||||
*/
|
||||
isBetweenRowSpacer(row: Row): number {
|
||||
@@ -290,8 +311,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a top row.
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @return 1 if the object stores information about a top row.
|
||||
* @returns 1 if the object stores information about a top row.
|
||||
* @internal
|
||||
*/
|
||||
isTopRow(row: Row): number {
|
||||
@@ -300,8 +322,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a bottom row.
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @return 1 if the object stores information about a bottom row.
|
||||
* @returns 1 if the object stores information about a bottom row.
|
||||
* @internal
|
||||
*/
|
||||
isBottomRow(row: Row): number {
|
||||
@@ -310,8 +333,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about a top or bottom row.
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @return 1 if the object stores information about a top or bottom row.
|
||||
* @returns 1 if the object stores information about a top or bottom row.
|
||||
* @internal
|
||||
*/
|
||||
isTopOrBottomRow(row: Row): number {
|
||||
@@ -320,8 +344,9 @@ class TypesContainer {
|
||||
|
||||
/**
|
||||
* Whether a measurable stores information about an input row.
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @return 1 if the object stores information about an input row.
|
||||
* @returns 1 if the object stores information about an input row.
|
||||
* @internal
|
||||
*/
|
||||
isInputRow(row: Row): number {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object that provides constants for rendering blocks in the
|
||||
* minimalist renderer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in the
|
||||
* minimalist renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -22,6 +18,7 @@ import {ConstantProvider as BaseConstantProvider} from '../common/constants.js';
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in the sample.
|
||||
*
|
||||
* @alias Blockly.minimalist.ConstantProvider
|
||||
*/
|
||||
export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Minimalist rendering drawer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Minimalist rendering drawer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -23,6 +20,7 @@ import type {RenderInfo} from './info.js';
|
||||
|
||||
/**
|
||||
* An object that draws a block based on the given rendering information.
|
||||
*
|
||||
* @alias Blockly.minimalist.Drawer
|
||||
*/
|
||||
export class Drawer extends BaseDrawer {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Minimalist render info object.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Minimalist render info object.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -27,6 +24,7 @@ import type {Renderer} from './renderer.js';
|
||||
* This measure pass does not propagate changes to the block (although fields
|
||||
* may choose to rerender when getSize() is called). However, calling it
|
||||
* repeatedly may be expensive.
|
||||
*
|
||||
* @alias Blockly.minimalist.RenderInfo
|
||||
*/
|
||||
export class RenderInfo extends BaseRenderInfo {
|
||||
@@ -41,7 +39,8 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
|
||||
/**
|
||||
* Get the block renderer in use.
|
||||
* @return The block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** @fileoverview Re-exports of Blockly.minimalist.* modules. */
|
||||
/** @file Re-exports of Blockly.minimalist.* modules. */
|
||||
|
||||
/**
|
||||
* @license
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.minimalist.* modules.
|
||||
*
|
||||
* @namespace Blockly.minimalist
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Minimalist renderer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Minimalist renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -27,6 +24,7 @@ import {RenderInfo} from './info.js';
|
||||
|
||||
/**
|
||||
* The minimalist renderer.
|
||||
*
|
||||
* @alias Blockly.minimalist.Renderer
|
||||
*/
|
||||
export class Renderer extends BaseRenderer {
|
||||
@@ -40,7 +38,8 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's constant provider.
|
||||
* @return The constant provider.
|
||||
*
|
||||
* @returns The constant provider.
|
||||
*/
|
||||
protected override makeConstants_(): ConstantProvider {
|
||||
return new ConstantProvider();
|
||||
@@ -48,8 +47,9 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's render info object.
|
||||
*
|
||||
* @param block The block to measure.
|
||||
* @return The render info object.
|
||||
* @returns The render info object.
|
||||
*/
|
||||
protected override makeRenderInfo_(block: BlockSvg): RenderInfo {
|
||||
return new RenderInfo(this, block);
|
||||
@@ -57,10 +57,11 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's drawer.
|
||||
*
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @return The drawer.
|
||||
* @returns The drawer.
|
||||
*/
|
||||
protected override makeDrawer_(block: BlockSvg, info: BaseRenderInfo):
|
||||
Drawer {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview New (evolving) renderer.
|
||||
* Thrasos: spirit of boldness.
|
||||
*/
|
||||
|
||||
/**
|
||||
* New (evolving) renderer.
|
||||
* Thrasos: spirit of boldness.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -36,6 +32,7 @@ import type {Renderer} from './renderer.js';
|
||||
* This measure pass does not propagate changes to the block (although fields
|
||||
* may choose to rerender when getSize() is called). However, calling it
|
||||
* repeatedly may be expensive.
|
||||
*
|
||||
* @alias Blockly.thrasos.RenderInfo
|
||||
*/
|
||||
export class RenderInfo extends BaseRenderInfo {
|
||||
@@ -54,7 +51,8 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
|
||||
/**
|
||||
* Get the block renderer in use.
|
||||
* @return The block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Thrasos renderer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Thrasos renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -24,6 +21,7 @@ import {RenderInfo} from './info.js';
|
||||
|
||||
/**
|
||||
* The thrasos renderer.
|
||||
*
|
||||
* @alias Blockly.thrasos.Renderer
|
||||
*/
|
||||
export class Renderer extends BaseRenderer {
|
||||
@@ -37,8 +35,9 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's render info object.
|
||||
*
|
||||
* @param block The block to measure.
|
||||
* @return The render info object.
|
||||
* @returns The render info object.
|
||||
*/
|
||||
protected override makeRenderInfo_(block: BlockSvg): RenderInfo {
|
||||
return new RenderInfo(this, block);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** @fileoverview Re-exports of Blockly.thrasos.* modules. */
|
||||
/** @file Re-exports of Blockly.thrasos.* modules. */
|
||||
|
||||
/**
|
||||
* @license
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.thrasos.* modules.
|
||||
*
|
||||
* @namespace Blockly.thrasos
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object that provides constants for rendering blocks in Zelos
|
||||
* mode.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in Zelos
|
||||
* mode.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -42,6 +38,7 @@ export interface InsideCorners {
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in Zelos mode.
|
||||
*
|
||||
* @alias Blockly.zelos.ConstantProvider
|
||||
*/
|
||||
export class ConstantProvider extends BaseConstantProvider {
|
||||
@@ -77,6 +74,7 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
/**
|
||||
* Radius of the cursor for input and output connections.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
CURSOR_RADIUS = 5;
|
||||
@@ -133,6 +131,7 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
/**
|
||||
* The ID of the selected glow filter, or the empty string if no filter is
|
||||
* set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
selectedGlowFilterId = '';
|
||||
@@ -147,6 +146,7 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
/**
|
||||
* The ID of the replacement glow filter, or the empty string if no filter
|
||||
* is set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
replacementGlowFilterId = '';
|
||||
@@ -235,6 +235,7 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
* When a block with the outer shape contains an input block with the inner
|
||||
* shape on its left or right edge, the block elements are aligned such that
|
||||
* the padding specified is reached.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
this.SHAPE_IN_SHAPE_PADDING = {
|
||||
@@ -348,7 +349,8 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
/**
|
||||
* Create sizing and path information about a hexagonal shape.
|
||||
* @return An object containing sizing and path information about a hexagonal
|
||||
*
|
||||
* @returns An object containing sizing and path information about a hexagonal
|
||||
* shape for connections.
|
||||
* @internal
|
||||
*/
|
||||
@@ -361,11 +363,12 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
* height. The 'up' and 'down' versions of the paths are the same, but the Y
|
||||
* sign flips. The 'left' and 'right' versions of the path are also the
|
||||
* same, but the X sign flips.
|
||||
*
|
||||
* @param height The height of the block the connection is on.
|
||||
* @param up True if the path should be drawn from bottom to top, false
|
||||
* otherwise.
|
||||
* @param right True if the path is for the right side of the block.
|
||||
* @return A path fragment describing a rounded connection.
|
||||
* @returns A path fragment describing a rounded connection.
|
||||
*/
|
||||
function makeMainPath(height: number, up: boolean, right: boolean): string {
|
||||
const halfHeight = height / 2;
|
||||
@@ -410,7 +413,8 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
/**
|
||||
* Create sizing and path information about a rounded shape.
|
||||
* @return An object containing sizing and path information about a rounded
|
||||
*
|
||||
* @returns An object containing sizing and path information about a rounded
|
||||
* shape for connections.
|
||||
* @internal
|
||||
*/
|
||||
@@ -426,11 +430,12 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
* drawn in between the two arcs. The 'up' and 'down' versions of the paths
|
||||
* are the same, but the Y sign flips. The 'up' and 'right' versions of the
|
||||
* path flip the sweep-flag which moves the arc at negative angles.
|
||||
*
|
||||
* @param blockHeight The height of the block the connection is on.
|
||||
* @param up True if the path should be drawn from bottom to top, false
|
||||
* otherwise.
|
||||
* @param right True if the path is for the right side of the block.
|
||||
* @return A path fragment describing a rounded connection.
|
||||
* @returns A path fragment describing a rounded connection.
|
||||
*/
|
||||
function makeMainPath(
|
||||
blockHeight: number, up: boolean, right: boolean): string {
|
||||
@@ -481,7 +486,8 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
/**
|
||||
* Create sizing and path information about a squared shape.
|
||||
* @return An object containing sizing and path information about a squared
|
||||
*
|
||||
* @returns An object containing sizing and path information about a squared
|
||||
* shape for connections.
|
||||
* @internal
|
||||
*/
|
||||
@@ -495,11 +501,12 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
* The 'left' and 'right' versions of the paths are the same, but the Y sign
|
||||
* flips. The 'up' and 'down' versions of the path determine where the
|
||||
* corner point is placed and in turn the direction of the corners.
|
||||
*
|
||||
* @param height The height of the block the connection is on.
|
||||
* @param up True if the path should be drawn from bottom to top, false
|
||||
* otherwise.
|
||||
* @param right True if the path is for the right side of the block.
|
||||
* @return A path fragment describing a squared connection.
|
||||
* @returns A path fragment describing a squared connection.
|
||||
*/
|
||||
function makeMainPath(height: number, up: boolean, right: boolean): string {
|
||||
const innerHeight = height - radius * 2;
|
||||
@@ -595,9 +602,10 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
/**
|
||||
* Make the main path for the notch.
|
||||
*
|
||||
* @param dir Direction multiplier to apply to horizontal offsets along the
|
||||
* path. Either 1 or -1.
|
||||
* @return A path fragment describing a notch.
|
||||
* @returns A path fragment describing a notch.
|
||||
*/
|
||||
function makeMainPath(dir: number): string {
|
||||
return svgPaths.curve(
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Zelos renderer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -33,6 +30,7 @@ import type {PathObject} from './path_object.js';
|
||||
|
||||
/**
|
||||
* An object that draws a block based on the given rendering information.
|
||||
*
|
||||
* @alias Blockly.zelos.Drawer
|
||||
*/
|
||||
export class Drawer extends BaseDrawer {
|
||||
@@ -105,6 +103,7 @@ export class Drawer extends BaseDrawer {
|
||||
/**
|
||||
* Add steps for the right side of a row that does not have value or
|
||||
* statement input connections.
|
||||
*
|
||||
* @param row The row to draw the side of.
|
||||
*/
|
||||
protected override drawRightSideRow_(row: Row) {
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/**
|
||||
* @fileoverview Makecode/scratch-style renderer.
|
||||
* Zelos: spirit of eager rivalry, emulation, envy, jealousy, and zeal.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
@@ -11,6 +6,7 @@
|
||||
|
||||
/**
|
||||
* Makecode/scratch-style renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -46,6 +42,7 @@ import type {Renderer} from './renderer.js';
|
||||
* This measure pass does not propagate changes to the block (although fields
|
||||
* may choose to rerender when getSize() is called). However, calling it
|
||||
* repeatedly may be expensive.
|
||||
*
|
||||
* @alias Blockly.zelos.RenderInfo
|
||||
*/
|
||||
export class RenderInfo extends BaseRenderInfo {
|
||||
@@ -109,7 +106,8 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
|
||||
/**
|
||||
* Get the block renderer in use.
|
||||
* @return The block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
@@ -458,8 +456,9 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
/**
|
||||
* Calculate the spacing to reduce the left and right edges by based on the
|
||||
* outer and inner connection shape.
|
||||
*
|
||||
* @param elem The first or last element on a block.
|
||||
* @return The amount of spacing to reduce the first or last spacer.
|
||||
* @returns The amount of spacing to reduce the first or last spacer.
|
||||
*/
|
||||
protected getNegativeSpacing_(elem: Measurable): number {
|
||||
if (!elem) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Methods for graphically rendering a marker as SVG.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a marker as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -30,6 +27,7 @@ import type {ConstantProvider as ZelosConstantProvider} from './constants.js';
|
||||
|
||||
/**
|
||||
* Class to draw a marker.
|
||||
*
|
||||
* @alias Blockly.zelos.MarkerSvg
|
||||
*/
|
||||
export class MarkerSvg extends BaseMarkerSvg {
|
||||
@@ -51,6 +49,7 @@ export class MarkerSvg extends BaseMarkerSvg {
|
||||
|
||||
/**
|
||||
* Position and display the marker for an input or an output connection.
|
||||
*
|
||||
* @param curNode The node to draw the marker for.
|
||||
*/
|
||||
private showWithInputOutput_(curNode: ASTNode) {
|
||||
@@ -73,6 +72,7 @@ export class MarkerSvg extends BaseMarkerSvg {
|
||||
|
||||
/**
|
||||
* Draw a rectangle around the block.
|
||||
*
|
||||
* @param curNode The current node of the marker.
|
||||
*/
|
||||
override showWithBlock_(curNode: ASTNode) {
|
||||
@@ -89,6 +89,7 @@ export class MarkerSvg extends BaseMarkerSvg {
|
||||
|
||||
/**
|
||||
* Position the circle we use for input and output connections.
|
||||
*
|
||||
* @param x The x position of the circle.
|
||||
* @param y The y position of the circle.
|
||||
*/
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object representing the bottom row of a rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object representing the bottom row of a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
@@ -25,6 +22,7 @@ import {BottomRow as BaseBottomRow} from '../../../renderers/measurables/bottom_
|
||||
* a block as well as spacing information for the top row.
|
||||
* Elements in a bottom row can consist of corners, spacers and next
|
||||
* connections.
|
||||
*
|
||||
* @alias Blockly.zelos.BottomRow
|
||||
*/
|
||||
export class BottomRow extends BaseBottomRow {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Zelos specific objects representing inputs with connections on
|
||||
* a rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos specific objects representing inputs with connections on
|
||||
* a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
@@ -26,6 +22,7 @@ import {StatementInput as BaseStatementInput} from '../../../renderers/measurabl
|
||||
/**
|
||||
* An object containing information about the space a statement input takes up
|
||||
* during rendering.
|
||||
*
|
||||
* @alias Blockly.zelos.StatementInput
|
||||
*/
|
||||
export class StatementInput extends BaseStatementInput {
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Zelos specific objects representing elements in a row of a
|
||||
* rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos specific objects representing elements in a row of a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
@@ -25,6 +21,7 @@ import {Types} from '../../../renderers/measurables/types.js';
|
||||
/**
|
||||
* An object containing information about the space a right connection shape
|
||||
* takes up during rendering.
|
||||
*
|
||||
* @alias Blockly.zelos.RightConnectionShape
|
||||
*/
|
||||
export class RightConnectionShape extends Measurable {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object representing the top row of a rendered block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object representing the top row of a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
@@ -27,6 +24,7 @@ import {TopRow as BaseTopRow} from '../../../renderers/measurables/top_row.js';
|
||||
* connections.
|
||||
* After this constructor is called, the row will contain all non-spacer
|
||||
* elements it needs.
|
||||
*
|
||||
* @alias Blockly.zelos.TopRow
|
||||
*/
|
||||
export class TopRow extends BaseTopRow {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview An object that owns a block's rendering SVG elements.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that owns a block's rendering SVG elements.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -32,6 +29,7 @@ import type {ConstantProvider} from './constants.js';
|
||||
/**
|
||||
* An object that handles creating and setting each of the SVG elements
|
||||
* used by the renderer.
|
||||
*
|
||||
* @alias Blockly.zelos.PathObject
|
||||
*/
|
||||
export class PathObject extends BasePathObject {
|
||||
@@ -144,6 +142,7 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* Method that's called when the drawer is about to draw the block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
beginDrawing() {
|
||||
@@ -155,6 +154,7 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* Method that's called when the drawer is done drawing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
endDrawing() {
|
||||
@@ -171,6 +171,7 @@ export class PathObject extends BasePathObject {
|
||||
/**
|
||||
* Set the path generated by the renderer for an outline path on the
|
||||
* respective outline path SVG element.
|
||||
*
|
||||
* @param name The input name.
|
||||
* @param pathString The path.
|
||||
* @internal
|
||||
@@ -183,8 +184,9 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* Create's an outline path for the specified input.
|
||||
*
|
||||
* @param name The input name.
|
||||
* @return The SVG outline path.
|
||||
* @returns The SVG outline path.
|
||||
*/
|
||||
private getOutlinePath_(name: string): SVGElement {
|
||||
if (!this.outlines.has(name)) {
|
||||
@@ -206,6 +208,7 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* Remove an outline path that is associated with the specified input.
|
||||
*
|
||||
* @param name The input name.
|
||||
*/
|
||||
private removeOutlinePath_(name: string) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Zelos renderer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
@@ -40,6 +37,7 @@ import {PathObject} from './path_object.js';
|
||||
|
||||
/**
|
||||
* The zelos renderer.
|
||||
*
|
||||
* @alias Blockly.zelos.Renderer
|
||||
*/
|
||||
export class Renderer extends BaseRenderer {
|
||||
@@ -55,7 +53,8 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's constant provider.
|
||||
* @return The constant provider.
|
||||
*
|
||||
* @returns The constant provider.
|
||||
*/
|
||||
protected override makeConstants_(): ConstantProvider {
|
||||
return new ConstantProvider();
|
||||
@@ -63,8 +62,9 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's render info object.
|
||||
*
|
||||
* @param block The block to measure.
|
||||
* @return The render info object.
|
||||
* @returns The render info object.
|
||||
*/
|
||||
protected override makeRenderInfo_(block: BlockSvg): RenderInfo {
|
||||
return new RenderInfo(this, block);
|
||||
@@ -72,10 +72,11 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's drawer.
|
||||
*
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @return The drawer.
|
||||
* @returns The drawer.
|
||||
*/
|
||||
protected override makeDrawer_(block: BlockSvg, info: BaseRenderInfo):
|
||||
Drawer {
|
||||
@@ -84,9 +85,10 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of the renderer's cursor drawer.
|
||||
*
|
||||
* @param workspace The workspace the cursor belongs to.
|
||||
* @param marker The marker.
|
||||
* @return The object in charge of drawing the marker.
|
||||
* @returns The object in charge of drawing the marker.
|
||||
* @internal
|
||||
*/
|
||||
override makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker):
|
||||
@@ -96,9 +98,10 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* Create a new instance of a renderer path object.
|
||||
*
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @return The renderer path object.
|
||||
* @returns The renderer path object.
|
||||
* @internal
|
||||
*/
|
||||
override makePathObject(root: SVGElement, style: BlockStyle): PathObject {
|
||||
@@ -109,7 +112,8 @@ export class Renderer extends BaseRenderer {
|
||||
/**
|
||||
* Get the current renderer's constant provider. We assume that when this is
|
||||
* called, the renderer has already been initialized.
|
||||
* @return The constant provider.
|
||||
*
|
||||
* @returns The constant provider.
|
||||
*/
|
||||
override getConstants(): ConstantProvider {
|
||||
return this.constants_;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** @fileoverview Re-exports of Blockly.zelos.* modules. */
|
||||
/** @file Re-exports of Blockly.zelos.* modules. */
|
||||
|
||||
/**
|
||||
* @license
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.zelos.* modules.
|
||||
*
|
||||
* @namespace Blockly.zelos
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
|
||||
Reference in New Issue
Block a user