mirror of
https://github.com/google/blockly.git
synced 2026-03-14 09:10:09 +01:00
feat: make renderer methods public or protected (#6887)
* feat: make renderering methods public or protected * chore: formatting * chore: recommend thrasos more strongly
This commit is contained in:
committed by
GitHub
parent
5cae074431
commit
8173d139e1
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Namespace for block rendering functionality.
|
||||
*
|
||||
* @namespace Blockly.blockRendering
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering');
|
||||
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.ConstantProvider');
|
||||
|
||||
@@ -237,8 +232,6 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* The backing colour of a field's border rect.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
FIELD_BORDER_RECT_COLOUR = '#fff';
|
||||
FIELD_TEXT_BASELINE_CENTER: boolean;
|
||||
@@ -280,7 +273,6 @@ export class ConstantProvider {
|
||||
FIELD_COLOUR_DEFAULT_WIDTH = 26;
|
||||
FIELD_COLOUR_DEFAULT_HEIGHT: number;
|
||||
FIELD_CHECKBOX_X_OFFSET: number;
|
||||
/** @internal */
|
||||
randomIdentifier: string;
|
||||
|
||||
/**
|
||||
@@ -291,8 +283,6 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* The ID of the emboss filter, or the empty string if no filter is set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
embossFilterId = '';
|
||||
|
||||
@@ -301,8 +291,6 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* The ID of the disabled pattern, or the empty string if no pattern is set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
disabledPatternId = '';
|
||||
|
||||
@@ -326,72 +314,52 @@ 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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@@ -409,10 +377,9 @@ export class ConstantProvider {
|
||||
// TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
|
||||
OUTSIDE_CORNERS!: OutsideCorners;
|
||||
// TODO(b/109816955): remove '!', see go/strict-prop-init-fix.
|
||||
/** @internal */
|
||||
|
||||
blockStyles!: {[key: string]: BlockStyle};
|
||||
|
||||
/** @internal */
|
||||
constructor() {
|
||||
/**
|
||||
* Offset from the top of the row for placing fields on inline input rows
|
||||
@@ -493,16 +460,12 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize shape objects based on the constants set in the constructor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
init() {
|
||||
/**
|
||||
@@ -537,7 +500,6 @@ export class ConstantProvider {
|
||||
* Refresh constants properties that depend on the theme.
|
||||
*
|
||||
* @param theme The current workspace theme.
|
||||
* @internal
|
||||
*/
|
||||
setTheme(theme: Theme) {
|
||||
/** The block styles map. */
|
||||
@@ -615,7 +577,6 @@ export class ConstantProvider {
|
||||
* @param colour #RRGGBB colour string.
|
||||
* @returns An object containing the style and an autogenerated name for that
|
||||
* style.
|
||||
* @internal
|
||||
*/
|
||||
getBlockStyleForColour(colour: string): {style: BlockStyle, name: string} {
|
||||
const name = 'auto_' + colour;
|
||||
@@ -700,8 +661,6 @@ export class ConstantProvider {
|
||||
/**
|
||||
* Dispose of this constants provider.
|
||||
* Delete all DOM elements that this provider created.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
dispose() {
|
||||
if (this.embossFilter_) {
|
||||
@@ -719,9 +678,8 @@ export class ConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about collapsed
|
||||
* block indicators.
|
||||
* @internal
|
||||
*/
|
||||
makeJaggedTeeth(): JaggedTeeth {
|
||||
protected makeJaggedTeeth(): JaggedTeeth {
|
||||
const height = this.JAGGED_TEETH_HEIGHT;
|
||||
const width = this.JAGGED_TEETH_WIDTH;
|
||||
|
||||
@@ -735,9 +693,8 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* @returns An object containing sizing and path information about start hats.
|
||||
* @internal
|
||||
*/
|
||||
makeStartHat(): StartHat {
|
||||
protected makeStartHat(): StartHat {
|
||||
const height = this.START_HAT_HEIGHT;
|
||||
const width = this.START_HAT_WIDTH;
|
||||
|
||||
@@ -752,9 +709,8 @@ export class ConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about puzzle
|
||||
* tabs.
|
||||
* @internal
|
||||
*/
|
||||
makePuzzleTab(): PuzzleTab {
|
||||
protected makePuzzleTab(): PuzzleTab {
|
||||
const width = this.TAB_WIDTH;
|
||||
const height = this.TAB_HEIGHT;
|
||||
|
||||
@@ -809,9 +765,8 @@ export class ConstantProvider {
|
||||
|
||||
/**
|
||||
* @returns An object containing sizing and path information about notches.
|
||||
* @internal
|
||||
*/
|
||||
makeNotch(): Notch {
|
||||
protected makeNotch(): Notch {
|
||||
const width = this.NOTCH_WIDTH;
|
||||
const height = this.NOTCH_HEIGHT;
|
||||
const innerWidth = 3;
|
||||
@@ -846,9 +801,8 @@ export class ConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about inside
|
||||
* corners.
|
||||
* @internal
|
||||
*/
|
||||
makeInsideCorners(): InsideCorners {
|
||||
protected makeInsideCorners(): InsideCorners {
|
||||
const radius = this.CORNER_RADIUS;
|
||||
|
||||
const innerTopLeftCorner =
|
||||
@@ -868,9 +822,8 @@ export class ConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about outside
|
||||
* corners.
|
||||
* @internal
|
||||
*/
|
||||
makeOutsideCorners(): OutsideCorners {
|
||||
protected makeOutsideCorners(): OutsideCorners {
|
||||
const radius = this.CORNER_RADIUS;
|
||||
/** SVG path for drawing the rounded top-left corner. */
|
||||
const topLeft = svgPaths.moveBy(0, radius) +
|
||||
@@ -903,7 +856,6 @@ export class ConstantProvider {
|
||||
*
|
||||
* @param connection The connection to find a shape object for
|
||||
* @returns The shape object for the connection.
|
||||
* @internal
|
||||
*/
|
||||
shapeFor(connection: RenderedConnection): Shape {
|
||||
switch (connection.type) {
|
||||
@@ -926,7 +878,6 @@ export class ConstantProvider {
|
||||
* @param selector The CSS selector to use.
|
||||
* @suppress {strictModuleDepCheck} Debug renderer only included in
|
||||
* playground.
|
||||
* @internal
|
||||
*/
|
||||
createDom(svg: SVGElement, tagName: string, selector: string) {
|
||||
this.injectCSS_(tagName, selector);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Block rendering debugging functionality.
|
||||
*
|
||||
* @namespace Blockly.blockRendering.debug
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.debug');
|
||||
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for rendering debug graphics.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Debug');
|
||||
|
||||
@@ -62,16 +57,13 @@ export class Debug {
|
||||
|
||||
/**
|
||||
* @param constants The renderer's constants.
|
||||
* @internal
|
||||
*/
|
||||
constructor(private readonly constants: ConstantProvider) {}
|
||||
|
||||
/**
|
||||
* Remove all elements the this object created on the last pass.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
clearElems() {
|
||||
protected clearElems() {
|
||||
for (let i = 0; i < this.debugElements_.length; i++) {
|
||||
const elem = this.debugElements_[i];
|
||||
dom.removeNode(elem);
|
||||
@@ -86,9 +78,8 @@ export class Debug {
|
||||
* @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.
|
||||
* @internal
|
||||
*/
|
||||
drawSpacerRow(row: Row, cursorY: number, isRtl: boolean) {
|
||||
protected drawSpacerRow(row: Row, cursorY: number, isRtl: boolean) {
|
||||
if (!Debug.config.rowSpacers) {
|
||||
return;
|
||||
}
|
||||
@@ -120,9 +111,9 @@ export class Debug {
|
||||
* @param elem The spacer to render.
|
||||
* @param rowHeight The height of the container row.
|
||||
* @param isRtl Whether the block is rendered RTL.
|
||||
* @internal
|
||||
*/
|
||||
drawSpacerElem(elem: InRowSpacer, rowHeight: number, isRtl: boolean) {
|
||||
protected drawSpacerElem(
|
||||
elem: InRowSpacer, rowHeight: number, isRtl: boolean) {
|
||||
if (!Debug.config.elemSpacers) {
|
||||
return;
|
||||
}
|
||||
@@ -154,9 +145,8 @@ export class Debug {
|
||||
*
|
||||
* @param elem The element to render.
|
||||
* @param isRtl Whether the block is rendered RTL.
|
||||
* @internal
|
||||
*/
|
||||
drawRenderedElem(elem: Measurable, isRtl: boolean) {
|
||||
protected drawRenderedElem(elem: Measurable, isRtl: boolean) {
|
||||
if (Debug.config.elems) {
|
||||
let xPos = elem.xPos;
|
||||
if (isRtl) {
|
||||
@@ -208,9 +198,8 @@ export class Debug {
|
||||
* @param conn The connection to circle.
|
||||
* @suppress {visibility} Suppress visibility of conn.offsetInBlock_ since
|
||||
* this is a debug module.
|
||||
* @internal
|
||||
*/
|
||||
drawConnection(conn: RenderedConnection) {
|
||||
protected drawConnection(conn: RenderedConnection) {
|
||||
if (!Debug.config.connections) {
|
||||
return;
|
||||
}
|
||||
@@ -253,9 +242,8 @@ export class Debug {
|
||||
* @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.
|
||||
* @internal
|
||||
*/
|
||||
drawRenderedRow(row: Row, cursorY: number, isRtl: boolean) {
|
||||
protected drawRenderedRow(row: Row, cursorY: number, isRtl: boolean) {
|
||||
if (!Debug.config.rows) {
|
||||
return;
|
||||
}
|
||||
@@ -299,9 +287,8 @@ export class Debug {
|
||||
* @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.
|
||||
* @internal
|
||||
*/
|
||||
drawRowWithElements(row: Row, cursorY: number, isRtl: boolean) {
|
||||
protected drawRowWithElements(row: Row, cursorY: number, isRtl: boolean) {
|
||||
for (let i = 0; i < row.elements.length; i++) {
|
||||
const elem = row.elements[i];
|
||||
if (!elem) {
|
||||
@@ -321,9 +308,8 @@ export class Debug {
|
||||
* Draw a debug rectangle around the entire block.
|
||||
*
|
||||
* @param info Rendering information about the block to debug.
|
||||
* @internal
|
||||
*/
|
||||
drawBoundingBox(info: RenderInfo) {
|
||||
protected drawBoundingBox(info: RenderInfo) {
|
||||
if (!Debug.config.blockBounds) {
|
||||
return;
|
||||
}
|
||||
@@ -368,7 +354,6 @@ export class Debug {
|
||||
*
|
||||
* @param block The block to draw debug information for.
|
||||
* @param info Rendering information about the block to debug.
|
||||
* @internal
|
||||
*/
|
||||
drawDebug(block: BlockSvg, info: RenderInfo) {
|
||||
this.clearElems();
|
||||
@@ -415,9 +400,8 @@ export class Debug {
|
||||
* Show a debug filter to highlight that a block has been rendered.
|
||||
*
|
||||
* @param svgPath The block's SVG path.
|
||||
* @internal
|
||||
*/
|
||||
drawRender(svgPath: SVGElement) {
|
||||
protected drawRender(svgPath: SVGElement) {
|
||||
if (!Debug.config.render) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a block as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Drawer');
|
||||
|
||||
@@ -45,7 +40,6 @@ export class Drawer {
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @internal
|
||||
*/
|
||||
constructor(block: BlockSvg, info: RenderInfo) {
|
||||
this.block_ = block;
|
||||
@@ -64,8 +58,6 @@ 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() {
|
||||
this.hideHiddenIcons_();
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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';
|
||||
goog.declareModuleId('Blockly.blockRendering.IPathObject');
|
||||
|
||||
@@ -28,8 +22,6 @@ import {RenderedConnection} from '../../rendered_connection.js';
|
||||
export interface IPathObject {
|
||||
/**
|
||||
* The primary path of the block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
svgPath: SVGElement;
|
||||
|
||||
@@ -55,7 +47,6 @@ export interface IPathObject {
|
||||
* Set the path generated by the renderer onto the respective SVG element.
|
||||
*
|
||||
* @param pathString The path.
|
||||
* @internal
|
||||
*/
|
||||
setPath(pathString: string): void;
|
||||
|
||||
@@ -64,7 +55,6 @@ export interface IPathObject {
|
||||
* the paths belong to a shadow block.
|
||||
*
|
||||
* @param block The source block.
|
||||
* @internal
|
||||
*/
|
||||
applyColour(block: BlockSvg): void;
|
||||
|
||||
@@ -72,14 +62,11 @@ export interface IPathObject {
|
||||
* Update the style.
|
||||
*
|
||||
* @param blockStyle The block style to use.
|
||||
* @internal
|
||||
*/
|
||||
setStyle(blockStyle: BlockStyle): void;
|
||||
|
||||
/**
|
||||
* Flip the SVG paths in RTL.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
flipRTL(): void;
|
||||
|
||||
@@ -88,7 +75,6 @@ export interface IPathObject {
|
||||
*
|
||||
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
*/
|
||||
setCursorSvg(cursorSvg: SVGElement): void;
|
||||
|
||||
@@ -97,7 +83,6 @@ export interface IPathObject {
|
||||
*
|
||||
* @param markerSvg The SVG root of the marker to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
*/
|
||||
setMarkerSvg(markerSvg: SVGElement): void;
|
||||
|
||||
@@ -106,7 +91,6 @@ export interface IPathObject {
|
||||
* often used to visually mark blocks currently being executed.
|
||||
*
|
||||
* @param highlighted True if highlighted.
|
||||
* @internal
|
||||
*/
|
||||
updateHighlighted(highlighted: boolean): void;
|
||||
|
||||
@@ -114,7 +98,6 @@ export interface IPathObject {
|
||||
* Add or remove styling showing that a block is selected.
|
||||
*
|
||||
* @param enable True if selection is enabled, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
updateSelected(enabled: boolean): void;
|
||||
|
||||
@@ -123,7 +106,6 @@ export interface IPathObject {
|
||||
*
|
||||
* @param enable True if the block is being dragged over a delete area, false
|
||||
* otherwise.
|
||||
* @internal
|
||||
*/
|
||||
updateDraggingDelete(enabled: boolean): void;
|
||||
|
||||
@@ -131,7 +113,6 @@ 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
|
||||
*/
|
||||
updateInsertionMarker(enabled: boolean): void;
|
||||
|
||||
@@ -139,7 +120,6 @@ export interface IPathObject {
|
||||
* Add or remove styling showing that a block is movable.
|
||||
*
|
||||
* @param enable True if the block is movable, false otherwise.
|
||||
* @internal
|
||||
*/
|
||||
updateMovable(enabled: boolean): void;
|
||||
|
||||
@@ -149,7 +129,6 @@ export interface IPathObject {
|
||||
* Otherwise it will bump.
|
||||
*
|
||||
* @param enable True if styling should be added.
|
||||
* @internal
|
||||
*/
|
||||
updateReplacementFade(enabled: boolean): void;
|
||||
|
||||
@@ -159,7 +138,6 @@ export interface IPathObject {
|
||||
*
|
||||
* @param conn The connection on the input to highlight.
|
||||
* @param enable True if styling should be added.
|
||||
* @internal
|
||||
*/
|
||||
updateShapeForInputHighlight(conn: RenderedConnection, enable: boolean): void;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a block as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.RenderInfo');
|
||||
|
||||
@@ -92,7 +87,6 @@ export class RenderInfo {
|
||||
/**
|
||||
* @param renderer The renderer in use.
|
||||
* @param block The block to measure.
|
||||
* @internal
|
||||
*/
|
||||
constructor(renderer: Renderer, block: BlockSvg) {
|
||||
this.renderer_ = renderer;
|
||||
@@ -143,7 +137,6 @@ export class RenderInfo {
|
||||
* Get the block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
getRenderer(): Renderer {
|
||||
return this.renderer_;
|
||||
@@ -156,8 +149,6 @@ 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() {
|
||||
this.createRows_();
|
||||
@@ -225,10 +216,8 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Create all non-spacer elements that belong on the top row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
populateTopRow_() {
|
||||
protected populateTopRow_() {
|
||||
const hasPrevious = !!this.block_.previousConnection;
|
||||
const hasHat = (this.block_.hat ? this.block_.hat === 'cap' :
|
||||
this.constants_.ADD_START_HATS) &&
|
||||
@@ -270,10 +259,8 @@ export class RenderInfo {
|
||||
|
||||
/**
|
||||
* Create all non-spacer elements that belong on the bottom row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
populateBottomRow_() {
|
||||
protected populateBottomRow_() {
|
||||
this.bottomRow.hasNextConnection = !!this.block_.nextConnection;
|
||||
|
||||
const followsStatement = this.block_.inputList.length &&
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a marker as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.MarkerSvg');
|
||||
|
||||
@@ -45,7 +40,8 @@ const MARKER_CLASS = 'blocklyMarker';
|
||||
const HEIGHT_MULTIPLIER = 3 / 4;
|
||||
|
||||
/**
|
||||
* Class for a marker.
|
||||
* Class for a marker, containing methods for graphically rendering a marker as
|
||||
* SVG.
|
||||
*/
|
||||
export class MarkerSvg {
|
||||
/**
|
||||
@@ -121,7 +117,6 @@ export class MarkerSvg {
|
||||
* Create the DOM element for the marker.
|
||||
*
|
||||
* @returns The marker controls SVG group.
|
||||
* @internal
|
||||
*/
|
||||
createDom(): SVGElement {
|
||||
const className = this.isCursor() ? CURSOR_CLASS : MARKER_CLASS;
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that owns a block's rendering SVG elements.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.PathObject');
|
||||
|
||||
@@ -28,35 +23,27 @@ import type {IPathObject} from './i_path_object.js';
|
||||
*/
|
||||
export class PathObject implements IPathObject {
|
||||
svgRoot: SVGElement;
|
||||
/** @internal */
|
||||
svgPath: SVGElement;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
cursorSvg: SVGElement|null = null;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
markerSvg: SVGElement|null = null;
|
||||
|
||||
/** @internal */
|
||||
constants: ConstantProvider;
|
||||
/** @internal */
|
||||
style: BlockStyle;
|
||||
|
||||
/**
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @param constants The renderer's constants.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
root: SVGElement, style: BlockStyle, constants: ConstantProvider) {
|
||||
@@ -73,7 +60,6 @@ export class PathObject implements IPathObject {
|
||||
* Set the path generated by the renderer onto the respective SVG element.
|
||||
*
|
||||
* @param pathString The path.
|
||||
* @internal
|
||||
*/
|
||||
setPath(pathString: string) {
|
||||
this.svgPath.setAttribute('d', pathString);
|
||||
@@ -81,8 +67,6 @@ export class PathObject implements IPathObject {
|
||||
|
||||
/**
|
||||
* Flip the SVG paths in RTL.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
flipRTL() {
|
||||
// Mirror the block's path.
|
||||
@@ -94,7 +78,6 @@ export class PathObject implements IPathObject {
|
||||
*
|
||||
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
*/
|
||||
setCursorSvg(cursorSvg: SVGElement) {
|
||||
if (!cursorSvg) {
|
||||
@@ -111,7 +94,6 @@ export class PathObject implements IPathObject {
|
||||
*
|
||||
* @param markerSvg The SVG root of the marker to be added to the block SVG
|
||||
* group.
|
||||
* @internal
|
||||
*/
|
||||
setMarkerSvg(markerSvg: SVGElement) {
|
||||
if (!markerSvg) {
|
||||
@@ -132,7 +114,6 @@ export class PathObject implements IPathObject {
|
||||
* the paths belong to a shadow block.
|
||||
*
|
||||
* @param block The source block.
|
||||
* @internal
|
||||
*/
|
||||
applyColour(block: BlockSvg) {
|
||||
this.svgPath.setAttribute('stroke', this.style.colourTertiary);
|
||||
@@ -146,7 +127,6 @@ export class PathObject implements IPathObject {
|
||||
* Set the style.
|
||||
*
|
||||
* @param blockStyle The block style to use.
|
||||
* @internal
|
||||
*/
|
||||
setStyle(blockStyle: BlockStyle) {
|
||||
this.style = blockStyle;
|
||||
@@ -175,7 +155,6 @@ export class PathObject implements IPathObject {
|
||||
* often used to visually mark blocks currently being executed.
|
||||
*
|
||||
* @param enable True if highlighted.
|
||||
* @internal
|
||||
*/
|
||||
updateHighlighted(enable: boolean) {
|
||||
if (enable) {
|
||||
@@ -215,7 +194,6 @@ 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
|
||||
*/
|
||||
updateSelected(enable: boolean) {
|
||||
this.setClass_('blocklySelected', enable);
|
||||
@@ -226,7 +204,6 @@ export class PathObject implements IPathObject {
|
||||
*
|
||||
* @param enable True if the block is being dragged over a delete area, false
|
||||
* otherwise.
|
||||
* @internal
|
||||
*/
|
||||
updateDraggingDelete(enable: boolean) {
|
||||
this.setClass_('blocklyDraggingDelete', enable);
|
||||
@@ -236,7 +213,6 @@ 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
|
||||
*/
|
||||
updateInsertionMarker(enable: boolean) {
|
||||
this.setClass_('blocklyInsertionMarker', enable);
|
||||
@@ -246,7 +222,6 @@ 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
|
||||
*/
|
||||
updateMovable(enable: boolean) {
|
||||
this.setClass_('blocklyDraggable', enable);
|
||||
@@ -258,7 +233,6 @@ export class PathObject implements IPathObject {
|
||||
* Otherwise it will bump.
|
||||
*
|
||||
* @param enable True if styling should be added.
|
||||
* @internal
|
||||
*/
|
||||
updateReplacementFade(enable: boolean) {
|
||||
this.setClass_('blocklyReplaceable', enable);
|
||||
@@ -270,7 +244,6 @@ export class PathObject implements IPathObject {
|
||||
*
|
||||
* @param _conn The connection on the input to highlight.
|
||||
* @param _enable True if styling should be added.
|
||||
* @internal
|
||||
*/
|
||||
updateShapeForInputHighlight(_conn: Connection, _enable: boolean) {
|
||||
// NOOP
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Renderer');
|
||||
|
||||
@@ -40,19 +35,15 @@ export class Renderer implements IRegistrable {
|
||||
/** The renderer's constant provider. */
|
||||
protected constants_!: ConstantProvider;
|
||||
|
||||
/** @internal */
|
||||
name: string;
|
||||
protected name: string;
|
||||
|
||||
/**
|
||||
* Rendering constant overrides, passed in through options.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
overrides: object|null = null;
|
||||
protected overrides: object|null = null;
|
||||
|
||||
/**
|
||||
* @param name The renderer name.
|
||||
* @internal
|
||||
*/
|
||||
constructor(name: string) {
|
||||
this.name = name;
|
||||
@@ -62,7 +53,6 @@ export class Renderer implements IRegistrable {
|
||||
* Gets the class name that identifies this renderer.
|
||||
*
|
||||
* @returns The CSS class name.
|
||||
* @internal
|
||||
*/
|
||||
getClassName(): string {
|
||||
return this.name + '-renderer';
|
||||
@@ -73,7 +63,6 @@ export class Renderer implements IRegistrable {
|
||||
*
|
||||
* @param theme The workspace theme object.
|
||||
* @param opt_rendererOverrides Rendering constant overrides.
|
||||
* @internal
|
||||
*/
|
||||
init(
|
||||
theme: Theme, opt_rendererOverrides?: {[rendererConstant: string]: any}) {
|
||||
@@ -88,6 +77,8 @@ export class Renderer implements IRegistrable {
|
||||
|
||||
/**
|
||||
* Create any DOM elements that this renderer needs.
|
||||
* If you need to create additional DOM elements, override the
|
||||
* {@link ConstantProvider#createDom} method instead.
|
||||
*
|
||||
* @param svg The root of the workspace's SVG.
|
||||
* @param theme The workspace theme object.
|
||||
@@ -104,7 +95,6 @@ export class Renderer implements IRegistrable {
|
||||
*
|
||||
* @param svg The root of the workspace's SVG.
|
||||
* @param theme The workspace theme object.
|
||||
* @internal
|
||||
*/
|
||||
refreshDom(svg: SVGElement, theme: Theme) {
|
||||
const previousConstants = this.getConstants();
|
||||
@@ -123,8 +113,6 @@ export class Renderer implements IRegistrable {
|
||||
/**
|
||||
* Dispose of this renderer.
|
||||
* Delete all DOM elements that this renderer and its constants created.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
dispose() {
|
||||
if (this.constants_) {
|
||||
@@ -180,7 +168,6 @@ export class Renderer implements IRegistrable {
|
||||
* @param workspace The workspace the marker belongs to.
|
||||
* @param marker The marker.
|
||||
* @returns The object in charge of drawing the marker.
|
||||
* @internal
|
||||
*/
|
||||
makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker): MarkerSvg {
|
||||
return new MarkerSvg(workspace, this.getConstants(), marker);
|
||||
@@ -192,7 +179,6 @@ export class Renderer implements IRegistrable {
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @returns The renderer path object.
|
||||
* @internal
|
||||
*/
|
||||
makePathObject(root: SVGElement, style: BlockStyle): IPathObject {
|
||||
return new PathObject(root, style, (this.constants_));
|
||||
@@ -203,7 +189,6 @@ export class Renderer implements IRegistrable {
|
||||
* called, the renderer has already been initialized.
|
||||
*
|
||||
* @returns The constant provider.
|
||||
* @internal
|
||||
*/
|
||||
getConstants(): ConstantProvider {
|
||||
return this.constants_;
|
||||
@@ -214,7 +199,6 @@ export class Renderer implements IRegistrable {
|
||||
*
|
||||
* @param _conn The connection to determine whether or not to highlight.
|
||||
* @returns True if we should highlight the connection.
|
||||
* @internal
|
||||
*/
|
||||
shouldHighlightConnection(_conn: Connection): boolean {
|
||||
return true;
|
||||
@@ -231,9 +215,8 @@ export class Renderer implements IRegistrable {
|
||||
* @param orphanBlock The orphan block that wants to find a home.
|
||||
* @param localType The type of the connection being dragged.
|
||||
* @returns Whether there is a home for the orphan or not.
|
||||
* @internal
|
||||
*/
|
||||
orphanCanConnectAtEnd(
|
||||
protected orphanCanConnectAtEnd(
|
||||
topBlock: BlockSvg, orphanBlock: BlockSvg, localType: number): boolean {
|
||||
const orphanConnection = localType === ConnectionType.OUTPUT_VALUE ?
|
||||
orphanBlock.outputConnection :
|
||||
@@ -250,7 +233,6 @@ export class Renderer implements IRegistrable {
|
||||
* @param local The connection currently being dragged.
|
||||
* @param topBlock The block currently being dragged.
|
||||
* @returns The preview type to display.
|
||||
* @internal
|
||||
*/
|
||||
getConnectionPreviewMethod(
|
||||
closest: RenderedConnection, local: RenderedConnection,
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in Geras
|
||||
* mode.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.ConstantProvider');
|
||||
|
||||
@@ -33,9 +27,6 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
MAX_BOTTOM_WIDTH = 30;
|
||||
override STATEMENT_BOTTOM_SPACER = -this.NOTCH_HEIGHT / 2;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Renderer that preserves the look and feel of Blockly pre-2019.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.Drawer');
|
||||
|
||||
@@ -26,7 +21,8 @@ import type {PathObject} from './path_object.js';
|
||||
|
||||
|
||||
/**
|
||||
* An object that draws a block based on the given rendering information.
|
||||
* An object that draws a block based on the given rendering information,
|
||||
* customized for the geras renderer.
|
||||
*/
|
||||
export class Drawer extends BaseDrawer {
|
||||
highlighter_: Highlighter;
|
||||
@@ -37,7 +33,6 @@ export class Drawer extends BaseDrawer {
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @internal
|
||||
*/
|
||||
constructor(block: BlockSvg, info: RenderInfo) {
|
||||
super(block, info);
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.geras.* modules.
|
||||
*
|
||||
* @namespace Blockly.geras
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras');
|
||||
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects for rendering highlights on blocks.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.HighlightConstantProvider');
|
||||
|
||||
@@ -86,7 +81,6 @@ export class HighlightConstantProvider {
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
/** The renderer's constant provider. */
|
||||
@@ -94,16 +88,12 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize shape objects based on the constants set in the constructor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
init() {
|
||||
/**
|
||||
@@ -145,9 +135,8 @@ export class HighlightConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about inside
|
||||
* corner highlights.
|
||||
* @internal
|
||||
*/
|
||||
makeInsideCorner(): InsideCorner {
|
||||
protected makeInsideCorner(): InsideCorner {
|
||||
const radius = this.constantProvider.CORNER_RADIUS;
|
||||
const offset = this.OFFSET;
|
||||
|
||||
@@ -189,9 +178,8 @@ export class HighlightConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about outside
|
||||
* corner highlights.
|
||||
* @internal
|
||||
*/
|
||||
makeOutsideCorner(): OutsideCorner {
|
||||
protected makeOutsideCorner(): OutsideCorner {
|
||||
const radius = this.constantProvider.CORNER_RADIUS;
|
||||
const offset = this.OFFSET;
|
||||
|
||||
@@ -238,9 +226,8 @@ export class HighlightConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about puzzle tab
|
||||
* highlights.
|
||||
* @internal
|
||||
*/
|
||||
makePuzzleTab(): PuzzleTab {
|
||||
protected makePuzzleTab(): PuzzleTab {
|
||||
const width = this.constantProvider.TAB_WIDTH;
|
||||
const height = this.constantProvider.TAB_HEIGHT;
|
||||
|
||||
@@ -288,9 +275,8 @@ export class HighlightConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about notch
|
||||
* highlights.
|
||||
* @internal
|
||||
*/
|
||||
makeNotch(): Notch {
|
||||
protected makeNotch(): Notch {
|
||||
// This is only for the previous connection.
|
||||
const pathLeft = svgPaths.lineOnAxis('h', this.OFFSET) +
|
||||
this.constantProvider.NOTCH.pathLeft;
|
||||
@@ -300,9 +286,8 @@ export class HighlightConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about collapsed
|
||||
* block edge highlights.
|
||||
* @internal
|
||||
*/
|
||||
makeJaggedTeeth(): JaggedTeeth {
|
||||
protected makeJaggedTeeth(): JaggedTeeth {
|
||||
const pathLeft = svgPaths.lineTo(5.1, 2.6) + svgPaths.moveBy(-10.2, 6.8) +
|
||||
svgPaths.lineTo(5.1, 2.6);
|
||||
return {pathLeft, height: 12, width: 10.2};
|
||||
@@ -311,9 +296,8 @@ export class HighlightConstantProvider {
|
||||
/**
|
||||
* @returns An object containing sizing and path information about start
|
||||
* highlights.
|
||||
* @internal
|
||||
*/
|
||||
makeStartHat(): StartHat {
|
||||
protected makeStartHat(): StartHat {
|
||||
const hatHeight = this.constantProvider.START_HAT.height;
|
||||
const pathRtl = svgPaths.moveBy(25, -8.7) + svgPaths.curve('c', [
|
||||
svgPaths.point(29.7, -6.2),
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for adding highlights on block, for rendering in
|
||||
* compatibility mode.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.Highlighter');
|
||||
|
||||
@@ -55,7 +49,6 @@ export class Highlighter {
|
||||
/**
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @internal
|
||||
*/
|
||||
constructor(info: RenderInfo) {
|
||||
this.info_ = info;
|
||||
@@ -83,7 +76,6 @@ export class Highlighter {
|
||||
* Get the steps for the highlight path.
|
||||
*
|
||||
* @returns The steps for the highlight path.
|
||||
* @internal
|
||||
*/
|
||||
getPath(): string {
|
||||
return this.steps_ + '\n' + this.inlineSteps_;
|
||||
@@ -93,7 +85,6 @@ export class Highlighter {
|
||||
* Add a highlight to the top corner of a block.
|
||||
*
|
||||
* @param row The top row of the block.
|
||||
* @internal
|
||||
*/
|
||||
drawTopCorner(row: TopRow) {
|
||||
this.steps_ += svgPaths.moveBy(row.xPos, this.info_.startY);
|
||||
@@ -124,7 +115,6 @@ export class Highlighter {
|
||||
* Add a highlight on a jagged edge for a collapsed block.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
drawJaggedEdge_(row: Row) {
|
||||
if (this.info_.RTL) {
|
||||
@@ -139,7 +129,6 @@ export class Highlighter {
|
||||
* Add a highlight on a value input.
|
||||
*
|
||||
* @param row The row the input belongs to.
|
||||
* @internal
|
||||
*/
|
||||
drawValueInput(row: Row) {
|
||||
const input = row.getLastInput() as InlineInput;
|
||||
@@ -161,7 +150,6 @@ export class Highlighter {
|
||||
* Add a highlight on a statement input.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
drawStatementInput(row: Row) {
|
||||
const input = row.getLastInput();
|
||||
@@ -186,7 +174,6 @@ export class Highlighter {
|
||||
* Add a highlight on the right side of a row.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
drawRightSideRow(row: Row) {
|
||||
const rightEdge = row.xPos + row.width - this.highlightOffset_;
|
||||
@@ -206,7 +193,6 @@ export class Highlighter {
|
||||
* Add a highlight to the bottom row.
|
||||
*
|
||||
* @param row The row to highlight.
|
||||
* @internal
|
||||
*/
|
||||
drawBottomRow(row: BottomRow) {
|
||||
// Highlight the vertical edge of the bottom row on the input side.
|
||||
@@ -229,8 +215,6 @@ export class Highlighter {
|
||||
|
||||
/**
|
||||
* Draw the highlight on the left side of the block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
drawLeft() {
|
||||
const outputConnection = this.info_.outputConnection;
|
||||
@@ -265,7 +249,6 @@ export class Highlighter {
|
||||
* Add a highlight to an inline input.
|
||||
*
|
||||
* @param input The input to highlight.
|
||||
* @internal
|
||||
*/
|
||||
drawInlineInput(input: InlineInput) {
|
||||
const offset = this.highlightOffset_;
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Old (compatibility) renderer.
|
||||
* Geras: spirit of old age.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.RenderInfo');
|
||||
|
||||
@@ -34,7 +28,8 @@ import type {Renderer} from './renderer.js';
|
||||
|
||||
|
||||
/**
|
||||
* An object containing all sizing information needed to draw this block.
|
||||
* An object containing all sizing information needed to draw this block,
|
||||
* customized for the geras renderer.
|
||||
*
|
||||
* This measure pass does not propagate changes to the block (although fields
|
||||
* may choose to rerender when getSize() is called). However, calling it
|
||||
@@ -49,7 +44,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
/**
|
||||
* @param renderer The renderer in use.
|
||||
* @param block The block to measure.
|
||||
* @internal
|
||||
*/
|
||||
constructor(renderer: Renderer, block: BlockSvg) {
|
||||
super(renderer, block);
|
||||
@@ -60,7 +54,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
* Get the block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
return this.renderer_;
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing inline inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.InlineInput');
|
||||
|
||||
@@ -30,7 +24,6 @@ export class InlineInput extends BaseInlineInput {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param input The inline input to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: BaseConstantProvider, input: Input) {
|
||||
super(constants, input);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing statement inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.StatementInput');
|
||||
|
||||
@@ -30,7 +24,6 @@ export class StatementInput extends BaseStatementInput {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param input The statement input to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: BaseConstantProvider, input: Input) {
|
||||
super(constants, input);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that owns a block's rendering SVG elements.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.PathObject');
|
||||
|
||||
@@ -27,15 +22,11 @@ import type {ConstantProvider} from './constants.js';
|
||||
* used by the renderer.
|
||||
*/
|
||||
export class PathObject extends BasePathObject {
|
||||
/** @internal */
|
||||
svgPathDark: SVGElement;
|
||||
/** @internal */
|
||||
svgPathLight: SVGElement;
|
||||
|
||||
/**
|
||||
* The colour of the dark path on the block in '#RRGGBB' format.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
colourDark = '#000000';
|
||||
|
||||
@@ -43,7 +34,6 @@ export class PathObject extends BasePathObject {
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @param constants The renderer's constants.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
root: SVGElement, style: BlockStyle,
|
||||
@@ -72,7 +62,6 @@ export class PathObject extends BasePathObject {
|
||||
* Set the highlight path generated by the renderer onto the SVG element.
|
||||
*
|
||||
* @param highlightPath The highlight path.
|
||||
* @internal
|
||||
*/
|
||||
setHighlightPath(highlightPath: string) {
|
||||
this.svgPathLight.setAttribute('d', highlightPath);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Geras renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.geras.Renderer');
|
||||
|
||||
@@ -26,7 +21,12 @@ import {PathObject} from './path_object.js';
|
||||
|
||||
|
||||
/**
|
||||
* The geras renderer.
|
||||
* The geras renderer. This renderer was designed to be backwards compatible
|
||||
* with pre-2019 Blockly. Newer projects that are not constrained by backwards
|
||||
* compatibility should use thrasos, which is a more modern take on this
|
||||
* renderer.
|
||||
*
|
||||
* Geras is the ancient Greek spirit of old age.
|
||||
*/
|
||||
export class Renderer extends BaseRenderer {
|
||||
/** The renderer's highlight constant provider. */
|
||||
@@ -34,7 +34,6 @@ export class Renderer extends BaseRenderer {
|
||||
|
||||
/**
|
||||
* @param name The renderer name.
|
||||
* @internal
|
||||
*/
|
||||
constructor(name: string) {
|
||||
super(name);
|
||||
@@ -43,8 +42,6 @@ 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?: {[rendererConstant: string]: any}) {
|
||||
@@ -91,7 +88,6 @@ export class Renderer extends BaseRenderer {
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @returns The renderer path object.
|
||||
* @internal
|
||||
*/
|
||||
override makePathObject(root: SVGElement, style: BlockStyle): PathObject {
|
||||
return new PathObject(
|
||||
@@ -112,7 +108,6 @@ export class Renderer extends BaseRenderer {
|
||||
* is called, the renderer has already been initialized.
|
||||
*
|
||||
* @returns The highlight constant provider.
|
||||
* @internal
|
||||
*/
|
||||
getHighlightConstants(): HighlightConstantProvider {
|
||||
if (!this.highlightConstants_) {
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a block as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Measurable');
|
||||
|
||||
@@ -37,7 +32,6 @@ export class Measurable {
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
this.constants_ = constants;
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a bottom row on a rendered block.
|
||||
* of its subcomponents.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.BottomRow');
|
||||
|
||||
@@ -30,15 +24,11 @@ import {Types} from './types.js';
|
||||
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;
|
||||
|
||||
@@ -46,8 +36,6 @@ 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;
|
||||
|
||||
@@ -59,7 +47,6 @@ export class BottomRow extends Row {
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class representing the space a connection takes up during
|
||||
* rendering.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Connection');
|
||||
|
||||
@@ -33,7 +27,6 @@ export class Connection extends Measurable {
|
||||
* @param constants The rendering constants provider.
|
||||
* @param connectionModel The connection object on the block that this
|
||||
* represents.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
constants: ConstantProvider, public connectionModel: RenderedConnection) {
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing external value inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.ExternalValueInput');
|
||||
|
||||
@@ -35,7 +29,6 @@ export class ExternalValueInput extends InputConnection {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param input The external value input to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, input: Input) {
|
||||
super(constants, input);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a field in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Field');
|
||||
|
||||
@@ -36,7 +30,6 @@ export class Field extends Measurable {
|
||||
* @param constants The rendering constants provider.
|
||||
* @param field The field to measure and store information for.
|
||||
* @param parentInput The parent input for the field.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
constants: ConstantProvider, public field: BlocklyField,
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a hat in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Hat');
|
||||
|
||||
@@ -28,7 +22,6 @@ export class Hat extends Measurable {
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing an icon in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Icon');
|
||||
|
||||
@@ -23,7 +17,7 @@ import {Types} from './types.js';
|
||||
|
||||
/**
|
||||
* An object containing information about the space an icon takes up during
|
||||
* rendering
|
||||
* rendering.
|
||||
*/
|
||||
export class Icon extends Measurable {
|
||||
isVisible: boolean;
|
||||
@@ -31,11 +25,10 @@ export class Icon extends Measurable {
|
||||
|
||||
/**
|
||||
* An object containing information about the space an icon takes up during
|
||||
* rendering
|
||||
* rendering.
|
||||
*
|
||||
* @param constants The rendering constants provider.
|
||||
* @param icon The icon to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, public icon: BlocklyIcon) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a spacer in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.InRowSpacer');
|
||||
|
||||
@@ -27,7 +21,6 @@ export class InRowSpacer extends Measurable {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param width The width of the spacer.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, width: number) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing inline inputs with connections on a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.InlineInput');
|
||||
|
||||
@@ -23,7 +17,7 @@ import {Types} from './types.js';
|
||||
|
||||
/**
|
||||
* An object containing information about the space an inline input takes up
|
||||
* during rendering
|
||||
* during rendering.
|
||||
*/
|
||||
export class InlineInput extends InputConnection {
|
||||
connectionHeight: number;
|
||||
@@ -32,7 +26,6 @@ export class InlineInput extends InputConnection {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param input The inline input to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, input: Input) {
|
||||
super(constants, input);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing inputs with connections on a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.InputConnection');
|
||||
|
||||
@@ -23,7 +18,7 @@ import {Types} from './types.js';
|
||||
|
||||
/**
|
||||
* The base class to represent an input that takes up space on a block
|
||||
* during rendering
|
||||
* during rendering.
|
||||
*/
|
||||
export class InputConnection extends Connection {
|
||||
align: number;
|
||||
@@ -36,7 +31,6 @@ export class InputConnection extends Connection {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param input The input to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, public input: Input) {
|
||||
super(constants, input.connection as RenderedConnection);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a row that holds one or more inputs on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.InputRow');
|
||||
|
||||
@@ -28,14 +22,11 @@ import {Types} from './types.js';
|
||||
export class InputRow extends Row {
|
||||
/**
|
||||
* The total width of all blocks connected to this row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
connectedBlockWidths = 0;
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
@@ -44,8 +35,6 @@ export class InputRow extends Row {
|
||||
|
||||
/**
|
||||
* Inspect all subcomponents and populate all size properties on the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
override measure() {
|
||||
this.width = this.minWidth;
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a jagged edge in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.JaggedEdge');
|
||||
|
||||
@@ -20,13 +14,12 @@ import {Types} from './types.js';
|
||||
|
||||
|
||||
/**
|
||||
* An object containing information about the jagged edge of a collapsed block
|
||||
* takes up during rendering
|
||||
* An object containing information about the space the jagged edge of a
|
||||
* collapsed block takes up during rendering.
|
||||
*/
|
||||
export class JaggedEdge extends Measurable {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing the space a next connection takes up during
|
||||
* rendering.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.NextConnection');
|
||||
|
||||
@@ -29,7 +23,6 @@ export class NextConnection extends Connection {
|
||||
* @param constants The rendering constants provider.
|
||||
* @param connectionModel The connection object on the block that this
|
||||
* represents.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
constants: ConstantProvider, connectionModel: RenderedConnection) {
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing the space a output connection takes up
|
||||
* during rendering.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.OutputConnection');
|
||||
|
||||
@@ -33,7 +27,6 @@ export class OutputConnection extends Connection {
|
||||
* @param constants The rendering constants provider.
|
||||
* @param connectionModel The connection object on the block that this
|
||||
* represents.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
constants: ConstantProvider, connectionModel: RenderedConnection) {
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing the space a previous connection takes up
|
||||
* during rendering.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.PreviousConnection');
|
||||
|
||||
@@ -29,7 +23,6 @@ export class PreviousConnection extends Connection {
|
||||
* @param constants The rendering constants provider.
|
||||
* @param connectionModel The connection object on the block that this
|
||||
* represents.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
constants: ConstantProvider, connectionModel: RenderedConnection) {
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a round corner in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.RoundCorner');
|
||||
|
||||
@@ -27,7 +21,6 @@ export class RoundCorner extends Measurable {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param opt_position The position of this corner.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, opt_position?: string) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a single row on a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Row');
|
||||
|
||||
@@ -25,81 +20,60 @@ import {Types} from './types.js';
|
||||
* subcomponents.
|
||||
*/
|
||||
export class Row {
|
||||
/** @internal */
|
||||
type: number;
|
||||
|
||||
/**
|
||||
* An array of elements contained in this row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
elements: Measurable[] = [];
|
||||
|
||||
/**
|
||||
* The height of the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
height = 0;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The Y position of the row relative to the origin of the block's svg
|
||||
* group.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
yPos = 0;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@@ -112,30 +86,22 @@ 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;
|
||||
notchOffset: number;
|
||||
|
||||
/**
|
||||
* Alignment of the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
align: number|null = null;
|
||||
|
||||
@@ -143,7 +109,6 @@ export class Row {
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
/** The renderer's constant provider. */
|
||||
@@ -159,7 +124,6 @@ export class Row {
|
||||
* Get the last input on this row, if it has one.
|
||||
*
|
||||
* @returns The last input on the row, or null.
|
||||
* @internal
|
||||
*/
|
||||
getLastInput(): InputConnection|null {
|
||||
// TODO: Consider moving this to InputRow, if possible.
|
||||
@@ -174,8 +138,6 @@ export class Row {
|
||||
|
||||
/**
|
||||
* Inspect all subcomponents and populate all size properties on the row.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
measure() {
|
||||
throw Error('Unexpected attempt to measure a base Row.');
|
||||
@@ -185,7 +147,6 @@ export class Row {
|
||||
* Determines whether this row should start with an element spacer.
|
||||
*
|
||||
* @returns Whether the row should start with a spacer.
|
||||
* @internal
|
||||
*/
|
||||
startsWithElemSpacer(): boolean {
|
||||
return true;
|
||||
@@ -195,7 +156,6 @@ export class Row {
|
||||
* Determines whether this row should end with an element spacer.
|
||||
*
|
||||
* @returns Whether the row should end with a spacer.
|
||||
* @internal
|
||||
*/
|
||||
endsWithElemSpacer(): boolean {
|
||||
return true;
|
||||
@@ -205,7 +165,6 @@ export class Row {
|
||||
* Convenience method to get the first spacer element on this row.
|
||||
*
|
||||
* @returns The first spacer element on this row.
|
||||
* @internal
|
||||
*/
|
||||
getFirstSpacer(): InRowSpacer|null {
|
||||
for (let i = 0; i < this.elements.length; i++) {
|
||||
@@ -221,7 +180,6 @@ export class Row {
|
||||
* Convenience method to get the last spacer element on this row.
|
||||
*
|
||||
* @returns The last spacer element on this row.
|
||||
* @internal
|
||||
*/
|
||||
getLastSpacer(): InRowSpacer|null {
|
||||
for (let i = this.elements.length - 1; i >= 0; i--) {
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a spacer between two rows.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.SpacerRow');
|
||||
|
||||
@@ -34,7 +29,6 @@ export class SpacerRow extends Row {
|
||||
* @param constants The rendering constants provider.
|
||||
* @param height The height of the spacer.
|
||||
* @param width The width of the spacer.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
constants: ConstantProvider, public override height: number,
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Objects representing a square corner in a row of a rendered
|
||||
* block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.SquareCorner');
|
||||
|
||||
@@ -27,7 +21,6 @@ export class SquareCorner extends Measurable {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param opt_position The position of this corner.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, opt_position?: string) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing statement inputs with connections on a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.StatementInput');
|
||||
|
||||
@@ -29,7 +23,6 @@ export class StatementInput extends InputConnection {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param input The statement input to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, input: Input) {
|
||||
super(constants, input);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object representing a top row on a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.TopRow');
|
||||
|
||||
@@ -34,8 +29,6 @@ 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;
|
||||
|
||||
@@ -50,7 +43,6 @@ export class TopRow extends Row {
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
@@ -63,7 +55,6 @@ export class TopRow extends Row {
|
||||
*
|
||||
* @param block The block whose top row this represents.
|
||||
* @returns Whether or not the top row has a left square corner.
|
||||
* @internal
|
||||
*/
|
||||
hasLeftSquareCorner(block: BlockSvg): boolean {
|
||||
const hasHat =
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Measurable types.
|
||||
*
|
||||
* @namespace Blockly.blockRendering.Types
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.blockRendering.Types');
|
||||
|
||||
@@ -50,15 +45,11 @@ 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;
|
||||
|
||||
@@ -75,7 +66,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param type The name of the type.
|
||||
* @returns The enum flag value associated with that type.
|
||||
* @internal
|
||||
*/
|
||||
getType(type: string): number {
|
||||
if (!Object.prototype.hasOwnProperty.call(this, type)) {
|
||||
@@ -90,7 +80,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a field.
|
||||
* @internal
|
||||
*/
|
||||
isField(elem: Measurable): number {
|
||||
return elem.type & this.FIELD;
|
||||
@@ -101,7 +90,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a hat.
|
||||
* @internal
|
||||
*/
|
||||
isHat(elem: Measurable): number {
|
||||
return elem.type & this.HAT;
|
||||
@@ -112,7 +100,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about an icon.
|
||||
* @internal
|
||||
*/
|
||||
isIcon(elem: Measurable): number {
|
||||
return elem.type & this.ICON;
|
||||
@@ -123,7 +110,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a spacer.
|
||||
* @internal
|
||||
*/
|
||||
isSpacer(elem: Measurable|Row): number {
|
||||
return elem.type & this.SPACER;
|
||||
@@ -134,7 +120,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about an in-row spacer.
|
||||
* @internal
|
||||
*/
|
||||
isInRowSpacer(elem: Measurable): number {
|
||||
return elem.type & this.IN_ROW_SPACER;
|
||||
@@ -145,7 +130,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about an input.
|
||||
* @internal
|
||||
*/
|
||||
isInput(elem: Measurable): number {
|
||||
return elem.type & this.INPUT;
|
||||
@@ -156,7 +140,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about an external input.
|
||||
* @internal
|
||||
*/
|
||||
isExternalInput(elem: Measurable): number {
|
||||
return elem.type & this.EXTERNAL_VALUE_INPUT;
|
||||
@@ -167,7 +150,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about an inline input.
|
||||
* @internal
|
||||
*/
|
||||
isInlineInput(elem: Measurable): number {
|
||||
return elem.type & this.INLINE_INPUT;
|
||||
@@ -178,7 +160,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a statement input.
|
||||
* @internal
|
||||
*/
|
||||
isStatementInput(elem: Measurable): number {
|
||||
return elem.type & this.STATEMENT_INPUT;
|
||||
@@ -189,7 +170,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a previous connection.
|
||||
* @internal
|
||||
*/
|
||||
isPreviousConnection(elem: Measurable): number {
|
||||
return elem.type & this.PREVIOUS_CONNECTION;
|
||||
@@ -200,7 +180,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a next connection.
|
||||
* @internal
|
||||
*/
|
||||
isNextConnection(elem: Measurable): number {
|
||||
return elem.type & this.NEXT_CONNECTION;
|
||||
@@ -213,7 +192,6 @@ class TypesContainer {
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a previous or next
|
||||
* connection.
|
||||
* @internal
|
||||
*/
|
||||
isPreviousOrNextConnection(elem: Measurable): number {
|
||||
return elem.type & (this.PREVIOUS_CONNECTION | this.NEXT_CONNECTION);
|
||||
@@ -224,7 +202,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a left round corner.
|
||||
* @internal
|
||||
*/
|
||||
isLeftRoundedCorner(elem: Measurable): number {
|
||||
return elem.type & this.LEFT_ROUND_CORNER;
|
||||
@@ -235,7 +212,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a right round corner.
|
||||
* @internal
|
||||
*/
|
||||
isRightRoundedCorner(elem: Measurable): number {
|
||||
return elem.type & this.RIGHT_ROUND_CORNER;
|
||||
@@ -246,7 +222,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a left square corner.
|
||||
* @internal
|
||||
*/
|
||||
isLeftSquareCorner(elem: Measurable): number {
|
||||
return elem.type & this.LEFT_SQUARE_CORNER;
|
||||
@@ -257,7 +232,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a right square corner.
|
||||
* @internal
|
||||
*/
|
||||
isRightSquareCorner(elem: Measurable): number {
|
||||
return elem.type & this.RIGHT_SQUARE_CORNER;
|
||||
@@ -268,7 +242,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a corner.
|
||||
* @internal
|
||||
*/
|
||||
isCorner(elem: Measurable): number {
|
||||
return elem.type & this.CORNER;
|
||||
@@ -279,7 +252,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param elem The element to check.
|
||||
* @returns 1 if the object stores information about a jagged edge.
|
||||
* @internal
|
||||
*/
|
||||
isJaggedEdge(elem: Measurable): number {
|
||||
return elem.type & this.JAGGED_EDGE;
|
||||
@@ -290,7 +262,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @returns 1 if the object stores information about a row.
|
||||
* @internal
|
||||
*/
|
||||
isRow(row: Row): number {
|
||||
return row.type & this.ROW;
|
||||
@@ -301,7 +272,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @returns 1 if the object stores information about a between-row spacer.
|
||||
* @internal
|
||||
*/
|
||||
isBetweenRowSpacer(row: Row): number {
|
||||
return row.type & this.BETWEEN_ROW_SPACER;
|
||||
@@ -312,7 +282,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @returns 1 if the object stores information about a top row.
|
||||
* @internal
|
||||
*/
|
||||
isTopRow(row: Row): number {
|
||||
return row.type & this.TOP_ROW;
|
||||
@@ -323,7 +292,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @returns 1 if the object stores information about a bottom row.
|
||||
* @internal
|
||||
*/
|
||||
isBottomRow(row: Row): number {
|
||||
return row.type & this.BOTTOM_ROW;
|
||||
@@ -334,7 +302,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @returns 1 if the object stores information about a top or bottom row.
|
||||
* @internal
|
||||
*/
|
||||
isTopOrBottomRow(row: Row): number {
|
||||
return row.type & (this.TOP_ROW | this.BOTTOM_ROW);
|
||||
@@ -345,7 +312,6 @@ class TypesContainer {
|
||||
*
|
||||
* @param row The row to check.
|
||||
* @returns 1 if the object stores information about an input row.
|
||||
* @internal
|
||||
*/
|
||||
isInputRow(row: Row): number {
|
||||
return row.type & this.INPUT_ROW;
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in the
|
||||
* minimalist renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.minimalist.ConstantProvider');
|
||||
|
||||
@@ -17,10 +11,10 @@ import {ConstantProvider as BaseConstantProvider} from '../common/constants.js';
|
||||
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in the sample.
|
||||
* An object that provides constants for rendering blocks in the minimalist
|
||||
* renderer.
|
||||
*/
|
||||
export class ConstantProvider extends BaseConstantProvider {
|
||||
/** @internal */
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Minimalist rendering drawer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.minimalist.Drawer');
|
||||
|
||||
@@ -26,7 +21,6 @@ export class Drawer extends BaseDrawer {
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @internal
|
||||
*/
|
||||
constructor(block: BlockSvg, info: RenderInfo) {
|
||||
super(block, info);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Minimalist render info object.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.minimalist.RenderInfo');
|
||||
|
||||
@@ -32,7 +27,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
/**
|
||||
* @param renderer The renderer in use.
|
||||
* @param block The block to measure.
|
||||
* @internal
|
||||
*/
|
||||
constructor(renderer: Renderer, block: BlockSvg) {
|
||||
super(renderer, block);
|
||||
@@ -42,7 +36,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
* Get the block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
return this.renderer_;
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.minimalist.* modules.
|
||||
*
|
||||
* @namespace Blockly.minimalist
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.minimalist');
|
||||
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Minimalist renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.minimalist.Renderer');
|
||||
|
||||
@@ -28,7 +23,6 @@ import {RenderInfo} from './info.js';
|
||||
export class Renderer extends BaseRenderer {
|
||||
/**
|
||||
* @param name The renderer name.
|
||||
* @internal
|
||||
*/
|
||||
constructor(name: string) {
|
||||
super(name);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* New (evolving) renderer.
|
||||
* Thrasos: spirit of boldness.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.thrasos.RenderInfo');
|
||||
|
||||
@@ -40,7 +34,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
/**
|
||||
* @param renderer The renderer in use.
|
||||
* @param block The block to measure.
|
||||
* @internal
|
||||
*/
|
||||
constructor(renderer: Renderer, block: BlockSvg) {
|
||||
super(renderer, block);
|
||||
@@ -50,7 +43,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
* Get the block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
return this.renderer_;
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Thrasos renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.thrasos.Renderer');
|
||||
|
||||
@@ -20,12 +15,14 @@ import {RenderInfo} from './info.js';
|
||||
|
||||
|
||||
/**
|
||||
* The thrasos renderer.
|
||||
* The thrasos renderer. This is a more modern take on the legacy geras
|
||||
* renderer.
|
||||
*
|
||||
* Thrasos is the ancient Greek spirit of boldness.
|
||||
*/
|
||||
export class Renderer extends BaseRenderer {
|
||||
/**
|
||||
* @param name The renderer name.
|
||||
* @internal
|
||||
*/
|
||||
constructor(name: string) {
|
||||
super(name);
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.thrasos.* modules.
|
||||
*
|
||||
* @namespace Blockly.thrasos
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.thrasos');
|
||||
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks in Zelos
|
||||
* mode.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.ConstantProvider');
|
||||
|
||||
@@ -47,8 +41,6 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
|
||||
/**
|
||||
* Radius of the cursor for input and output connections.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
CURSOR_RADIUS = 5;
|
||||
|
||||
@@ -67,8 +59,6 @@ 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
|
||||
*/
|
||||
SHAPE_IN_SHAPE_PADDING: {[key: number]: {[key: number]: number}} = {
|
||||
1: {
|
||||
@@ -126,8 +116,6 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
/**
|
||||
* The ID of the selected glow filter, or the empty string if no filter is
|
||||
* set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
selectedGlowFilterId = '';
|
||||
|
||||
@@ -139,8 +127,6 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
/**
|
||||
* The ID of the replacement glow filter, or the empty string if no filter
|
||||
* is set.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
replacementGlowFilterId = '';
|
||||
|
||||
@@ -167,7 +153,6 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
*/
|
||||
SQUARED: Shape|null = null;
|
||||
|
||||
/** @internal */
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
@@ -310,9 +295,8 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
*
|
||||
* @returns An object containing sizing and path information about a hexagonal
|
||||
* shape for connections.
|
||||
* @internal
|
||||
*/
|
||||
makeHexagonal(): Shape {
|
||||
protected makeHexagonal(): Shape {
|
||||
const maxWidth = this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;
|
||||
|
||||
/**
|
||||
@@ -374,9 +358,8 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
*
|
||||
* @returns An object containing sizing and path information about a rounded
|
||||
* shape for connections.
|
||||
* @internal
|
||||
*/
|
||||
makeRounded(): Shape {
|
||||
protected makeRounded(): Shape {
|
||||
const maxWidth = this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;
|
||||
const maxHeight = maxWidth * 2;
|
||||
|
||||
@@ -447,9 +430,8 @@ export class ConstantProvider extends BaseConstantProvider {
|
||||
*
|
||||
* @returns An object containing sizing and path information about a squared
|
||||
* shape for connections.
|
||||
* @internal
|
||||
*/
|
||||
makeSquared(): Shape {
|
||||
protected makeSquared(): Shape {
|
||||
const radius = this.CORNER_RADIUS;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.Drawer');
|
||||
|
||||
@@ -39,7 +34,6 @@ export class Drawer extends BaseDrawer {
|
||||
* @param block The block to render.
|
||||
* @param info An object containing all information needed to render this
|
||||
* block.
|
||||
* @internal
|
||||
*/
|
||||
constructor(block: BlockSvg, info: RenderInfo) {
|
||||
super(block, info);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Makecode/scratch-style renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.RenderInfo');
|
||||
|
||||
@@ -58,7 +53,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
/**
|
||||
* @param renderer The renderer in use.
|
||||
* @param block The block to measure.
|
||||
* @internal
|
||||
*/
|
||||
constructor(renderer: Renderer, block: BlockSvg) {
|
||||
super(renderer, block);
|
||||
@@ -106,7 +100,6 @@ export class RenderInfo extends BaseRenderInfo {
|
||||
* Get the block renderer in use.
|
||||
*
|
||||
* @returns The block renderer in use.
|
||||
* @internal
|
||||
*/
|
||||
override getRenderer(): Renderer {
|
||||
return this.renderer_ as Renderer;
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Methods for graphically rendering a marker as SVG.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.MarkerSvg');
|
||||
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object representing the bottom row of a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.BottomRow');
|
||||
|
||||
@@ -26,7 +21,6 @@ import {BottomRow as BaseBottomRow} from '../../../renderers/measurables/bottom_
|
||||
export class BottomRow extends BaseBottomRow {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos specific objects representing inputs with connections on
|
||||
* a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.StatementInput');
|
||||
|
||||
@@ -29,7 +23,6 @@ export class StatementInput extends BaseStatementInput {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @param input The statement input to measure and store information for.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider, input: Input) {
|
||||
super(constants, input);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos specific objects representing elements in a row of a
|
||||
* rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.RightConnectionShape');
|
||||
|
||||
@@ -29,7 +23,6 @@ export class RightConnectionShape extends Measurable {
|
||||
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object representing the top row of a rendered block.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.TopRow');
|
||||
|
||||
@@ -28,7 +23,6 @@ import {TopRow as BaseTopRow} from '../../../renderers/measurables/top_row.js';
|
||||
export class TopRow extends BaseTopRow {
|
||||
/**
|
||||
* @param constants The rendering constants provider.
|
||||
* @internal
|
||||
*/
|
||||
constructor(constants: ConstantProvider) {
|
||||
super(constants);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that owns a block's rendering SVG elements.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.PathObject');
|
||||
|
||||
@@ -47,14 +42,12 @@ export class PathObject extends BasePathObject {
|
||||
*/
|
||||
outputShapeType: number|null = null;
|
||||
|
||||
/** @internal */
|
||||
public override constants: ConstantProvider;
|
||||
|
||||
/**
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @param constants The renderer's constants.
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
root: SVGElement, style: BlockStyle, constants: ConstantProvider) {
|
||||
@@ -136,8 +129,6 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* Method that's called when the drawer is about to draw the block.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
beginDrawing() {
|
||||
this.remainingOutlines.clear();
|
||||
@@ -148,8 +139,6 @@ export class PathObject extends BasePathObject {
|
||||
|
||||
/**
|
||||
* Method that's called when the drawer is done drawing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
endDrawing() {
|
||||
// Go through all remaining outlines that were not used this draw pass, and
|
||||
@@ -168,7 +157,6 @@ export class PathObject extends BasePathObject {
|
||||
*
|
||||
* @param name The input name.
|
||||
* @param pathString The path.
|
||||
* @internal
|
||||
*/
|
||||
setOutlinePath(name: string, pathString: string) {
|
||||
const outline = this.getOutlinePath_(name);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zelos renderer.
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos.Renderer');
|
||||
|
||||
@@ -32,14 +27,16 @@ import {PathObject} from './path_object.js';
|
||||
|
||||
|
||||
/**
|
||||
* The zelos renderer.
|
||||
* The zelos renderer. This renderer emulates Scratch-style and MakeCode-style
|
||||
* rendering.
|
||||
*
|
||||
* Zelos is the ancient Greek spirit of rivalry and emulation.
|
||||
*/
|
||||
export class Renderer extends BaseRenderer {
|
||||
protected override constants_!: ConstantProvider;
|
||||
|
||||
/**
|
||||
* @param name The renderer name.
|
||||
* @internal
|
||||
*/
|
||||
constructor(name: string) {
|
||||
super(name);
|
||||
@@ -83,7 +80,6 @@ export class Renderer extends BaseRenderer {
|
||||
* @param workspace The workspace the cursor belongs to.
|
||||
* @param marker The marker.
|
||||
* @returns The object in charge of drawing the marker.
|
||||
* @internal
|
||||
*/
|
||||
override makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker):
|
||||
MarkerSvg {
|
||||
@@ -96,7 +92,6 @@ export class Renderer extends BaseRenderer {
|
||||
* @param root The root SVG element.
|
||||
* @param style The style object to use for colouring.
|
||||
* @returns The renderer path object.
|
||||
* @internal
|
||||
*/
|
||||
override makePathObject(root: SVGElement, style: BlockStyle): PathObject {
|
||||
return new PathObject(
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Re-exports of Blockly.zelos.* modules.
|
||||
*
|
||||
* @namespace Blockly.zelos
|
||||
*/
|
||||
import * as goog from '../../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.zelos');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user