Class: ConstantProvider

Constructor

ConstantProvider

new ConstantProvider()

An object that provides constants for rendering blocks in Zelos mode.

Extends
Blockly.blockRendering.ConstantProvider

Enumeration

SHAPES

unknown

Enum for connection shapes.

Value

HEXAGONAL

ROUND

SQUARE

PUZZLE

NOTCH

Inherited from
Blockly.zelos.ConstantProvider#SHAPES

Properties

ADD_START_HATS

unknown

Whether to add a 'hat' on top of all blocks with no previous or output connections. Can be overridden by 'hat' property on Theme.BlockStyle.

Inherited from
Blockly.blockRendering.ConstantProvider#ADD_START_HATS

BETWEEN_STATEMENT_PADDING_Y

unknown

Vertical padding between consecutive statement inputs.

Inherited from
Blockly.blockRendering.ConstantProvider#BETWEEN_STATEMENT_PADDING_Y

blockStyles

package

unknown

The block styles map.

Inherited from
Blockly.blockRendering.ConstantProvider#blockStyles

BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT

unknown

The bottom row's minimum height if it follows a statement input.

Inherited from
Blockly.zelos.ConstantProvider#BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT

BOTTOM_ROW_MIN_HEIGHT

unknown

The bottom row's minimum height.

Inherited from
Blockly.zelos.ConstantProvider#BOTTOM_ROW_MIN_HEIGHT

CORNER_RADIUS

unknown

Rounded corner radius.

Inherited from
Blockly.zelos.ConstantProvider#CORNER_RADIUS

CURSOR_BLOCK_PADDING

package

unknown

Padding around a block.

Inherited from
Blockly.blockRendering.ConstantProvider#CURSOR_BLOCK_PADDING

CURSOR_COLOUR

package

unknown

Cursor colour.

Inherited from
Blockly.zelos.ConstantProvider#CURSOR_COLOUR

CURSOR_RADIUS

package

number

Radius of the cursor for input and output connections.

CURSOR_STACK_PADDING

package

unknown

Padding around a stack.

Inherited from
Blockly.blockRendering.ConstantProvider#CURSOR_STACK_PADDING

CURSOR_STROKE_WIDTH

package

unknown

Stroke of the cursor.

Inherited from
Blockly.blockRendering.ConstantProvider#CURSOR_STROKE_WIDTH

CURSOR_WS_WIDTH

package

unknown

Width of the horizontal cursor.

Inherited from
Blockly.zelos.ConstantProvider#CURSOR_WS_WIDTH

debugFilterId

package

unknown

The ID of the debug filter, or the empty string if no pattern is set.

Inherited from
Blockly.blockRendering.ConstantProvider#debugFilterId

disabledPatternId

package

unknown

The ID of the disabled pattern, or the empty string if no pattern is set.

Inherited from
Blockly.blockRendering.ConstantProvider#disabledPatternId

DUMMY_INPUT_MIN_HEIGHT

unknown

The minimum height of a dummy input row.

Inherited from
Blockly.zelos.ConstantProvider#DUMMY_INPUT_MIN_HEIGHT

DUMMY_INPUT_SHADOW_MIN_HEIGHT

unknown

The minimum height of a dummy input row in a shadow block.

Inherited from
Blockly.zelos.ConstantProvider#DUMMY_INPUT_SHADOW_MIN_HEIGHT

embossFilterId

package

unknown

The ID of the emboss filter, or the empty string if no filter is set.

Inherited from
Blockly.blockRendering.ConstantProvider#embossFilterId

EMPTY_INLINE_INPUT_HEIGHT

unknown

The height of an empty inline input.

Inherited from
Blockly.zelos.ConstantProvider#EMPTY_INLINE_INPUT_HEIGHT

EMPTY_INLINE_INPUT_PADDING

EMPTY_STATEMENT_INPUT_HEIGHT

unknown

The height of an empty statement input. Note that in the old rendering this varies slightly depending on whether the block has external or inline inputs. In the new rendering this is consistent. It seems unlikely that the old behaviour was intentional.

Inherited from
Blockly.zelos.ConstantProvider#EMPTY_STATEMENT_INPUT_HEIGHT

FIELD_BORDER_RECT_COLOUR

package

unknown

The backing colour of a field's border rect.

Inherited from
Blockly.blockRendering.ConstantProvider#FIELD_BORDER_RECT_COLOUR

FIELD_BORDER_RECT_HEIGHT

unknown

A field's border rect default height.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_BORDER_RECT_HEIGHT

FIELD_BORDER_RECT_RADIUS

unknown

A field's border rect corner radius.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_BORDER_RECT_RADIUS

FIELD_BORDER_RECT_X_PADDING

unknown

A field's border rect X padding.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_BORDER_RECT_X_PADDING

FIELD_BORDER_RECT_Y_PADDING

unknown

A field's border rect Y padding.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_BORDER_RECT_Y_PADDING

FIELD_CHECKBOX_X_OFFSET

unknown

A checkbox field's X offset.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_CHECKBOX_X_OFFSET

FIELD_COLOUR_DEFAULT_HEIGHT

unknown

A colour field's default height.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_COLOUR_DEFAULT_HEIGHT

FIELD_COLOUR_DEFAULT_WIDTH

unknown

A colour field's default width.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_COLOUR_DEFAULT_WIDTH

FIELD_COLOUR_FULL_BLOCK

unknown

Whether or not the colour field should display its colour value on the entire block.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_COLOUR_FULL_BLOCK

FIELD_DROPDOWN_BORDER_RECT_HEIGHT

unknown

A dropdown field's border rect height.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_DROPDOWN_BORDER_RECT_HEIGHT

FIELD_DROPDOWN_COLOURED_DIV

unknown

Whether or not a dropdown field's div should be coloured to match the block colours.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_DROPDOWN_COLOURED_DIV

FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW

unknown

Whether or not a dropdown field should add a border rect when in a shadow block.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW

FIELD_DROPDOWN_SVG_ARROW

unknown

Whether or not a dropdown field uses a text or SVG arrow.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_DROPDOWN_SVG_ARROW

FIELD_DROPDOWN_SVG_ARROW_DATAURI

unknown

A dropdown field's SVG arrow datauri.

Inherited from
Blockly.blockRendering.ConstantProvider#FIELD_DROPDOWN_SVG_ARROW_DATAURI

FIELD_DROPDOWN_SVG_ARROW_PADDING

unknown

A dropdown field's SVG arrow padding.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_DROPDOWN_SVG_ARROW_PADDING

FIELD_DROPDOWN_SVG_ARROW_SIZE

unknown

A dropdown field's SVG arrow size.

Inherited from
Blockly.blockRendering.ConstantProvider#FIELD_DROPDOWN_SVG_ARROW_SIZE

FIELD_TEXT_BASELINE

unknown

Text baseline. This constant is dynamically set in setFontConstants_ to be the baseline of the text based on the font used.

Inherited from
Blockly.blockRendering.ConstantProvider#FIELD_TEXT_BASELINE

FIELD_TEXT_BASELINE_CENTER

unknown

A field's text element's dominant baseline.

Inherited from
Blockly.blockRendering.ConstantProvider#FIELD_TEXT_BASELINE_CENTER

FIELD_TEXT_FONTFAMILY

unknown

Text font family.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_TEXT_FONTFAMILY

FIELD_TEXT_FONTSIZE

unknown

Point size of text.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_TEXT_FONTSIZE

FIELD_TEXT_FONTWEIGHT

unknown

Text font weight.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_TEXT_FONTWEIGHT

FIELD_TEXT_HEIGHT

unknown

Height of text. This constant is dynamically set in setFontConstants_ to be the height of the text based on the font used.

Inherited from
Blockly.blockRendering.ConstantProvider#FIELD_TEXT_HEIGHT

FIELD_TEXTINPUT_BOX_SHADOW

unknown

Whether or not to show a box shadow around the widget div. This is only a feature of full block fields.

Inherited from
Blockly.zelos.ConstantProvider#FIELD_TEXTINPUT_BOX_SHADOW

FULL_BLOCK_FIELDS

package

unknown

Whether text input and colour fields fill up the entire source block.

Inherited from
Blockly.zelos.ConstantProvider#FULL_BLOCK_FIELDS

INSERTION_MARKER_COLOUR

package

unknown

The main colour of insertion markers, in hex. The block is rendered a transparent grey by changing the fill opacity in CSS.

Inherited from
Blockly.blockRendering.ConstantProvider#INSERTION_MARKER_COLOUR

INSERTION_MARKER_OPACITY

package

unknown

The insertion marker opacity.

Inherited from
Blockly.blockRendering.ConstantProvider#INSERTION_MARKER_OPACITY

INSIDE_CORNERS

unknown

An object containing sizing and path information about inside corners

Inherited from
Blockly.blockRendering.ConstantProvider#INSIDE_CORNERS

JAGGED_TEETH

unknown

An object containing sizing and path information about collapsed block indicators.

Inherited from
Blockly.blockRendering.ConstantProvider#JAGGED_TEETH

JAGGED_TEETH_HEIGHT

unknown

Height of SVG path for jagged teeth at the end of collapsed blocks.

Inherited from
Blockly.zelos.ConstantProvider#JAGGED_TEETH_HEIGHT

JAGGED_TEETH_WIDTH

unknown

Width of SVG path for jagged teeth at the end of collapsed blocks.

Inherited from
Blockly.zelos.ConstantProvider#JAGGED_TEETH_WIDTH

LARGE_PADDING

unknown

The size of large padding.

Inherited from
Blockly.zelos.ConstantProvider#LARGE_PADDING

MARKER_COLOUR

package

unknown

Immovable marker colour.

Inherited from
Blockly.blockRendering.ConstantProvider#MARKER_COLOUR

MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH

number

The maximum width of a dynamic connection shape.

MEDIUM_LARGE_PADDING

unknown

The size of medium-large padding.

Inherited from
Blockly.zelos.ConstantProvider#MEDIUM_LARGE_PADDING

MEDIUM_PADDING

unknown

The size of medium padding.

Inherited from
Blockly.zelos.ConstantProvider#MEDIUM_PADDING

MIN_BLOCK_HEIGHT

MIN_BLOCK_WIDTH

unknown

The minimum width of the block.

Inherited from
Blockly.zelos.ConstantProvider#MIN_BLOCK_WIDTH

NO_PADDING

unknown

The size of an empty spacer.

Inherited from
Blockly.blockRendering.ConstantProvider#NO_PADDING

NOTCH

unknown

An object containing sizing and path information about notches.

Inherited from
Blockly.blockRendering.ConstantProvider#NOTCH

NOTCH_HEIGHT

unknown

The height of the notch used for previous and next connections.

Inherited from
Blockly.zelos.ConstantProvider#NOTCH_HEIGHT

NOTCH_OFFSET_LEFT

unknown

Offset from the left side of a block or the inside of a statement input to the left side of the notch.

Inherited from
Blockly.zelos.ConstantProvider#NOTCH_OFFSET_LEFT

NOTCH_WIDTH

unknown

The width of the notch used for previous and next connections.

Inherited from
Blockly.zelos.ConstantProvider#NOTCH_WIDTH

OUTSIDE_CORNERS

unknown

An object containing sizing and path information about outside corners.

Inherited from
Blockly.blockRendering.ConstantProvider#OUTSIDE_CORNERS

PUZZLE_TAB

unknown

An object containing sizing and path information about puzzle tabs.

Inherited from
Blockly.blockRendering.ConstantProvider#PUZZLE_TAB

randomIdentifier

package

unknown

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.

Inherited from
Blockly.blockRendering.ConstantProvider#randomIdentifier

REPLACEMENT_GLOW_COLOUR

string

The replacement glow colour.

REPLACEMENT_GLOW_SIZE

number

The size of the selected glow.

replacementGlowFilterId

package

string

The ID of the replacement glow filter, or the empty string if no filter is set.

SELECTED_GLOW_COLOUR

string

The selected glow colour.

SELECTED_GLOW_SIZE

number

The size of the selected glow.

selectedGlowFilterId

package

string

The ID of the selected glow filter, or the empty string if no filter is set.

SHAPE_IN_SHAPE_PADDING

package

Map of output/input shapes and the amount they should cause a block to be padded. Outer key is the outer shape, inner key is the inner shape. 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.

SHAPES

unknown

Enum for connection shapes.

Value

HEXAGONAL

ROUND

SQUARE

PUZZLE

NOTCH

Inherited from
Blockly.zelos.ConstantProvider#SHAPES

SMALL_PADDING

unknown

The size of small padding.

Inherited from
Blockly.zelos.ConstantProvider#SMALL_PADDING

START_HAT

unknown

An object containing sizing and path information about start hats

Inherited from
Blockly.blockRendering.ConstantProvider#START_HAT

START_HAT_HEIGHT

unknown

Height of the top hat.

Inherited from
Blockly.zelos.ConstantProvider#START_HAT_HEIGHT

START_HAT_WIDTH

unknown

Width of the top hat.

Inherited from
Blockly.zelos.ConstantProvider#START_HAT_WIDTH

STATEMENT_BOTTOM_SPACER

STATEMENT_INPUT_NOTCH_OFFSET

unknown

Additional offset added to the statement input's width to account for the notch.

Inherited from
Blockly.zelos.ConstantProvider#STATEMENT_INPUT_NOTCH_OFFSET

STATEMENT_INPUT_PADDING_LEFT

STATEMENT_INPUT_SPACER_MIN_WIDTH

number

Minimum statement input spacer width.

TAB_HEIGHT

unknown

The height of the puzzle tab used for input and output connections.

Inherited from
Blockly.blockRendering.ConstantProvider#TAB_HEIGHT

TAB_OFFSET_FROM_TOP

unknown

The offset from the top of the block at which a puzzle tab is positioned.

Inherited from
Blockly.zelos.ConstantProvider#TAB_OFFSET_FROM_TOP

TAB_VERTICAL_OVERLAP

unknown

Vertical overlap of the puzzle tab, used to make it look more like a puzzle piece.

Inherited from
Blockly.blockRendering.ConstantProvider#TAB_VERTICAL_OVERLAP

TAB_WIDTH

unknown

The width of the puzzle tab used for input and output connections.

Inherited from
Blockly.blockRendering.ConstantProvider#TAB_WIDTH

TALL_INPUT_FIELD_OFFSET_Y

unknown

Offset from the top of the row for placing fields on inline input rows and statement input rows. Matches existing rendering (in 2019).

Inherited from
Blockly.blockRendering.ConstantProvider#TALL_INPUT_FIELD_OFFSET_Y

TOP_ROW_MIN_HEIGHT

unknown

The top row's minimum height.

Inherited from
Blockly.zelos.ConstantProvider#TOP_ROW_MIN_HEIGHT

TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT

unknown

The top row's minimum height if it precedes a statement.

Inherited from
Blockly.zelos.ConstantProvider#TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT

WS_CURSOR_HEIGHT

package

unknown

Height of the horizontal cursor.

Inherited from
Blockly.blockRendering.ConstantProvider#WS_CURSOR_HEIGHT

Methods

createBlockStyle_

protected

createBlockStyle_(colour) returns Blockly.Theme.BlockStyle

Create a block style object based on the given colour.

Parameter

colour

#RRGGBB colour string.

Inherited from
Blockly.blockRendering.ConstantProvider#createBlockStyle_
Returns

A populated block style based on the given colour.

createDom

package

createDom(svg, tagName, selector)

Create any DOM elements that this renderer needs (filters, patterns, etc).

Parameter

svg

The root of the workspace's SVG.

Value must not be null.

tagName

The name to use for the CSS style tag.

selector

The CSS selector to use.

Inherited from
Blockly.zelos.ConstantProvider#createDom

dispose

package

dispose()

Dispose of this constants provider. Delete all DOM elements that this provider created.

Inherited from
Blockly.zelos.ConstantProvider#dispose

generateSecondaryColour_

protected

generateSecondaryColour_(colour) returns string

Generate a secondary colour from the passed in primary colour.

Parameter

colour

Primary colour.

Inherited from
Blockly.zelos.ConstantProvider#generateSecondaryColour_
Returns

The generated secondary colour.

generateTertiaryColour_

protected

generateTertiaryColour_(colour) returns string

Generate a tertiary colour from the passed in primary colour.

Parameter

colour

Primary colour.

Inherited from
Blockly.zelos.ConstantProvider#generateTertiaryColour_
Returns

The generated tertiary colour.

getBlockStyle

getBlockStyle(blockStyleName) returns Blockly.Theme.BlockStyle

Gets the BlockStyle for the given block style name.

Parameter

blockStyleName

The name of the block style.

Value may be null.

Inherited from
Blockly.blockRendering.ConstantProvider#getBlockStyle
Returns

The named block style, or a default style if no style with the given name was found.

getBlockStyleForColour

package

getBlockStyleForColour(colour) returns Object

Get or create a block style based on a single colour value. Generate a name for the style based on the colour.

Parameter

colour

#RRGGBB colour string.

Inherited from
Blockly.blockRendering.ConstantProvider#getBlockStyleForColour
Returns

An object containing the style and an autogenerated name for that style.

getCSS_

protected

getCSS_(selector) returns Array of string

Get any renderer specific CSS to inject when the renderer is initialized.

Parameter

selector

CSS selector to use.

Inherited from
Blockly.zelos.ConstantProvider#getCSS_
Returns

Array of CSS strings.

init

package

init()

Initialize shape objects based on the constants set in the constructor.

Inherited from
Blockly.zelos.ConstantProvider#init

injectCSS_

protected

injectCSS_(tagName, selector)

Inject renderer specific CSS into the page.

Parameter

tagName

The name of the style tag to use.

selector

The CSS selector to use.

Inherited from
Blockly.blockRendering.ConstantProvider#injectCSS_

makeHexagonal

package

makeHexagonal() returns Object

Create sizing and path information about a hexagonal shape.

Returns

non-null Object An object containing sizing and path information about a hexagonal shape for connections.

makeInsideCorners

package

makeInsideCorners() returns Object

Inherited from
Blockly.zelos.ConstantProvider#makeInsideCorners
Returns

An object containing sizing and path information about inside corners.

makeJaggedTeeth

package

makeJaggedTeeth() returns Object

Inherited from
Blockly.blockRendering.ConstantProvider#makeJaggedTeeth
Returns

An object containing sizing and path information about collapsed block indicators.

makeNotch

package

makeNotch() returns Object

Inherited from
Blockly.zelos.ConstantProvider#makeNotch
Returns

An object containing sizing and path information about notches.

makeOutsideCorners

package

makeOutsideCorners() returns Object

Inherited from
Blockly.blockRendering.ConstantProvider#makeOutsideCorners
Returns

An object containing sizing and path information about outside corners.

makePuzzleTab

package

makePuzzleTab() returns Object

Inherited from
Blockly.blockRendering.ConstantProvider#makePuzzleTab
Returns

An object containing sizing and path information about puzzle tabs.

makeRounded

package

makeRounded() returns Object

Create sizing and path information about a rounded shape.

Returns

non-null Object An object containing sizing and path information about a rounded shape for connections.

makeSquared

package

makeSquared() returns Object

Create sizing and path information about a squared shape.

Returns

non-null Object An object containing sizing and path information about a squared shape for connections.

makeStartHat

package

makeStartHat() returns Object

Inherited from
Blockly.zelos.ConstantProvider#makeStartHat
Returns

An object containing sizing and path information about start hats.

setComponentConstants_

protected

setComponentConstants_(theme)

Set constants from a theme's component styles.

Parameter

theme

The current workspace theme.

Value must not be null.

Inherited from
Blockly.blockRendering.ConstantProvider#setComponentConstants_

setDynamicProperties_

protected

setDynamicProperties_(theme)

Sets dynamic properties that depend on other values or theme properties.

Parameter

theme

The current workspace theme.

Value must not be null.

Inherited from
Blockly.zelos.ConstantProvider#setDynamicProperties_

setFontConstants_

protected

setFontConstants_(theme)

Set constants related to fonts.

Parameter

theme

The current workspace theme.

Value must not be null.

Inherited from
Blockly.zelos.ConstantProvider#setFontConstants_

setTheme

package

setTheme(theme)

Refresh constants properties that depend on the theme.

Parameter

theme

The current workspace theme.

Value must not be null.

Inherited from
Blockly.blockRendering.ConstantProvider#setTheme

shapeFor

package

shapeFor(connection) returns Object

Get an object with connection shape and sizing information based on the type of the connection.

Parameter

connection

The connection to find a shape object for

Value must not be null.

Inherited from
Blockly.zelos.ConstantProvider#shapeFor
Returns

The shape object for the connection.

validatedBlockStyle_

protected

validatedBlockStyle_(blockStyle) returns Blockly.Theme.BlockStyle

Get a full block style object based on the input style object. Populate any missing values.

Parameter

blockStyle

A full or partial block style object.

Inherited from
Blockly.blockRendering.ConstantProvider#validatedBlockStyle_
Returns

A full block style object, with all required properties populated.