Blockly.minimalist. ConstantProvider
Constructor
ConstantProvider
new ConstantProvider()
An object that provides constants for rendering blocks in the sample.
Enumeration
SHAPES
unknown
Enum for connection shapes.
Value |
|
---|---|
PUZZLE |
|
NOTCH |
- Inherited from
- Blockly.blockRendering.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.
blockStyles
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.
BOTTOM_ROW_MIN_HEIGHT
unknown
The bottom row's minimum height.
CORNER_RADIUS
unknown
Rounded corner radius.
- Inherited from
- Blockly.blockRendering.ConstantProvider#CORNER_RADIUS
CURSOR_BLOCK_PADDING
unknown
Padding around a block.
- Inherited from
- Blockly.blockRendering.ConstantProvider#CURSOR_BLOCK_PADDING
CURSOR_COLOUR
unknown
Cursor colour.
- Inherited from
- Blockly.blockRendering.ConstantProvider#CURSOR_COLOUR
CURSOR_STACK_PADDING
unknown
Padding around a stack.
- Inherited from
- Blockly.blockRendering.ConstantProvider#CURSOR_STACK_PADDING
CURSOR_STROKE_WIDTH
unknown
Stroke of the cursor.
- Inherited from
- Blockly.blockRendering.ConstantProvider#CURSOR_STROKE_WIDTH
CURSOR_WS_WIDTH
unknown
Width of the horizontal cursor.
- Inherited from
- Blockly.blockRendering.ConstantProvider#CURSOR_WS_WIDTH
debugFilterId
unknown
The ID of the debug filter, or the empty string if no pattern is set.
- Inherited from
- Blockly.blockRendering.ConstantProvider#debugFilterId
disabledPatternId
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.
DUMMY_INPUT_SHADOW_MIN_HEIGHT
unknown
The minimum height of a dummy input row in a shadow block.
embossFilterId
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.
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.
FIELD_BORDER_RECT_COLOUR
unknown
The backing colour of a field's border rect.
FIELD_BORDER_RECT_HEIGHT
unknown
A field's border rect default height.
FIELD_BORDER_RECT_RADIUS
unknown
A field's border rect corner radius.
FIELD_BORDER_RECT_X_PADDING
unknown
A field's border rect X padding.
FIELD_BORDER_RECT_Y_PADDING
unknown
A field's border rect Y padding.
FIELD_CHECKBOX_X_OFFSET
unknown
A checkbox field's X offset.
FIELD_COLOUR_DEFAULT_HEIGHT
unknown
A colour field's default height.
FIELD_COLOUR_DEFAULT_WIDTH
unknown
A colour field's default width.
FIELD_COLOUR_FULL_BLOCK
unknown
Whether or not the colour field should display its colour value on the entire block.
FIELD_DROPDOWN_BORDER_RECT_HEIGHT
unknown
A dropdown field's border rect height.
FIELD_DROPDOWN_COLOURED_DIV
unknown
Whether or not a dropdown field's div should be coloured to match the block colours.
FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW
unknown
Whether or not a dropdown field should add a border rect when in a shadow block.
FIELD_DROPDOWN_SVG_ARROW
unknown
Whether or not a dropdown field uses a text or SVG arrow.
FIELD_DROPDOWN_SVG_ARROW_DATAURI
unknown
A dropdown field's SVG arrow datauri.
FIELD_DROPDOWN_SVG_ARROW_PADDING
unknown
A dropdown field's SVG arrow padding.
FIELD_DROPDOWN_SVG_ARROW_SIZE
unknown
A dropdown field's 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.
FIELD_TEXT_FONTFAMILY
unknown
Text font family.
FIELD_TEXT_FONTSIZE
unknown
Point size of text.
- Inherited from
- Blockly.blockRendering.ConstantProvider#FIELD_TEXT_FONTSIZE
FIELD_TEXT_FONTWEIGHT
unknown
Text font weight.
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.
FULL_BLOCK_FIELDS
unknown
Whether text input and colour fields fill up the entire source block.
- Inherited from
- Blockly.blockRendering.ConstantProvider#FULL_BLOCK_FIELDS
INSERTION_MARKER_COLOUR
unknown
The main colour of insertion markers, in hex. The block is rendered a transparent grey by changing the fill opacity in CSS.
INSERTION_MARKER_OPACITY
unknown
The 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.blockRendering.ConstantProvider#JAGGED_TEETH_HEIGHT
JAGGED_TEETH_WIDTH
unknown
Width of SVG path for jagged teeth at the end of collapsed blocks.
- Inherited from
- Blockly.blockRendering.ConstantProvider#JAGGED_TEETH_WIDTH
LARGE_PADDING
unknown
The size of large padding.
- Inherited from
- Blockly.blockRendering.ConstantProvider#LARGE_PADDING
MARKER_COLOUR
unknown
Immovable marker colour.
- Inherited from
- Blockly.blockRendering.ConstantProvider#MARKER_COLOUR
MEDIUM_LARGE_PADDING
unknown
The size of medium-large padding.
- Inherited from
- Blockly.blockRendering.ConstantProvider#MEDIUM_LARGE_PADDING
MEDIUM_PADDING
unknown
The size of medium padding.
- Inherited from
- Blockly.blockRendering.ConstantProvider#MEDIUM_PADDING
MIN_BLOCK_WIDTH
unknown
The minimum width of the block.
- Inherited from
- Blockly.blockRendering.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.blockRendering.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.blockRendering.ConstantProvider#NOTCH_OFFSET_LEFT
NOTCH_WIDTH
unknown
The width of the notch used for previous and next connections.
- Inherited from
- Blockly.blockRendering.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
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
SHAPES
unknown
Enum for connection shapes.
Value |
|
---|---|
PUZZLE |
|
NOTCH |
- Inherited from
- Blockly.blockRendering.ConstantProvider#SHAPES
SMALL_PADDING
unknown
The size of small padding.
- Inherited from
- Blockly.blockRendering.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.blockRendering.ConstantProvider#START_HAT_HEIGHT
START_HAT_WIDTH
unknown
Width of the top hat.
- Inherited from
- Blockly.blockRendering.ConstantProvider#START_HAT_WIDTH
STATEMENT_INPUT_NOTCH_OFFSET
unknown
Additional offset added to the statement input's width to account for the notch.
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.blockRendering.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).
TOP_ROW_MIN_HEIGHT
unknown
The top row's minimum height.
- Inherited from
- Blockly.blockRendering.ConstantProvider#TOP_ROW_MIN_HEIGHT
TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT
unknown
The top row's minimum height if it precedes a statement.
WS_CURSOR_HEIGHT
unknown
Height of the horizontal cursor.
- Inherited from
- Blockly.blockRendering.ConstantProvider#WS_CURSOR_HEIGHT
Methods
createBlockStyle_
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
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.blockRendering.ConstantProvider#createDom
dispose
dispose()
Dispose of this constants provider. Delete all DOM elements that this provider created.
- Inherited from
- Blockly.blockRendering.ConstantProvider#dispose
generateSecondaryColour_
generateSecondaryColour_(colour) returns string
Generate a secondary colour from the passed in primary colour.
Parameter |
|
---|---|
colour |
Primary colour. |
- Inherited from
- Blockly.blockRendering.ConstantProvider#generateSecondaryColour_
- Returns
-
The generated secondary colour.
generateTertiaryColour_
generateTertiaryColour_(colour) returns string
Generate a tertiary colour from the passed in primary colour.
Parameter |
|
---|---|
colour |
Primary colour. |
- Inherited from
- Blockly.blockRendering.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
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_
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.blockRendering.ConstantProvider#getCSS_
- Returns
-
Array of CSS strings.
init
init()
Initialize shape objects based on the constants set in the constructor.
- Inherited from
- Blockly.blockRendering.ConstantProvider#init
injectCSS_
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_
makeInsideCorners
makeInsideCorners() returns Object
- Inherited from
- Blockly.blockRendering.ConstantProvider#makeInsideCorners
- Returns
-
An object containing sizing and path information about inside corners.
makeJaggedTeeth
makeJaggedTeeth() returns Object
- Inherited from
- Blockly.blockRendering.ConstantProvider#makeJaggedTeeth
- Returns
-
An object containing sizing and path information about collapsed block indicators.
makeNotch
makeNotch() returns Object
- Inherited from
- Blockly.blockRendering.ConstantProvider#makeNotch
- Returns
-
An object containing sizing and path information about notches.
makeOutsideCorners
makeOutsideCorners() returns Object
- Inherited from
- Blockly.blockRendering.ConstantProvider#makeOutsideCorners
- Returns
-
An object containing sizing and path information about outside corners.
makePuzzleTab
makePuzzleTab() returns Object
- Inherited from
- Blockly.blockRendering.ConstantProvider#makePuzzleTab
- Returns
-
An object containing sizing and path information about puzzle tabs.
makeStartHat
makeStartHat() returns Object
- Inherited from
- Blockly.blockRendering.ConstantProvider#makeStartHat
- Returns
-
An object containing sizing and path information about start hats.
setComponentConstants_
setComponentConstants_(theme)
Set constants from a theme's component styles.
Parameter |
|
---|---|
theme |
The current workspace theme. Value must not be null. |
setDynamicProperties_
setDynamicProperties_(theme)
Sets dynamic properties that depend on other values or theme properties.
Parameter |
|
---|---|
theme |
The current workspace theme. Value must not be null. |
setFontConstants_
setFontConstants_(theme)
Set constants related to fonts.
Parameter |
|
---|---|
theme |
The current workspace theme. Value must not be null. |
- Inherited from
- Blockly.blockRendering.ConstantProvider#setFontConstants_
setTheme
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
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.blockRendering.ConstantProvider#shapeFor
- Returns
-
The shape object for the connection.
validatedBlockStyle_
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.