Stay organized with collections Save and categorize content based on your preferences.

blockly > blockRendering > ConstantProvider

blockRendering.ConstantProvider class

An object that provides constants for rendering blocks.

Signature:

export declare class ConstantProvider 

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ConstantProvider class.

Properties

Property Modifiers Type Description
ADD_START_HATS boolean 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.
BETWEEN_STATEMENT_PADDING_Y number Vertical padding between consecutive statement inputs.
BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT number
BOTTOM_ROW_MIN_HEIGHT number
CORNER_RADIUS number Rounded corner radius.
debugFilterId string The ID of the debug filter, or the empty string if no pattern is set.
DUMMY_INPUT_MIN_HEIGHT number
DUMMY_INPUT_SHADOW_MIN_HEIGHT number
EMPTY_BLOCK_SPACER_HEIGHT number
EMPTY_INLINE_INPUT_HEIGHT number
EMPTY_INLINE_INPUT_PADDING number
EMPTY_STATEMENT_INPUT_HEIGHT number
EXTERNAL_VALUE_INPUT_PADDING number
FIELD_BORDER_RECT_HEIGHT number A field's border rect default height.
FIELD_BORDER_RECT_RADIUS number A field's border rect corner radius.
FIELD_BORDER_RECT_X_PADDING number A field's border rect X padding.
FIELD_BORDER_RECT_Y_PADDING number A field's border rect Y padding.
FIELD_CHECKBOX_X_OFFSET number
FIELD_COLOUR_DEFAULT_HEIGHT number
FIELD_COLOUR_DEFAULT_WIDTH number A colour field's default width.
FIELD_COLOUR_FULL_BLOCK boolean Whether or not the colour field should display its colour value on the entire block.
FIELD_DROPDOWN_BORDER_RECT_HEIGHT number
FIELD_DROPDOWN_COLOURED_DIV boolean Whether or not a dropdown field's div should be coloured to match the block colours.
FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW boolean Whether or not a dropdown field should add a border rect when in a shadow block.
FIELD_DROPDOWN_SVG_ARROW_DATAURI string
FIELD_DROPDOWN_SVG_ARROW_PADDING number
FIELD_DROPDOWN_SVG_ARROW_SIZE number A dropdown field's SVG arrow size.
FIELD_DROPDOWN_SVG_ARROW boolean Whether or not a dropdown field uses a text or SVG arrow.
FIELD_TEXT_BASELINE_CENTER boolean
FIELD_TEXT_BASELINE number Text baseline. This constant is dynamically set in setFontConstants_ to be the baseline of the text based on the font used.
FIELD_TEXT_FONTFAMILY string Text font family.
FIELD_TEXT_FONTSIZE number Point size of text.
FIELD_TEXT_FONTWEIGHT string Text font weight.
FIELD_TEXT_HEIGHT number Height of text. This constant is dynamically set in setFontConstants_ to be the height of the text based on the font used.
FIELD_TEXTINPUT_BOX_SHADOW boolean Whether or not to show a box shadow around the widget div. This is only a feature of full block fields.
INSIDE_CORNERS InsideCorners
JAGGED_TEETH_HEIGHT number Height of SVG path for jagged teeth at the end of collapsed blocks.
JAGGED_TEETH_WIDTH number Width of SVG path for jagged teeth at the end of collapsed blocks.
JAGGED_TEETH JaggedTeeth
LARGE_PADDING number The size of large padding.
MEDIUM_LARGE_PADDING number The size of medium-large padding.
MEDIUM_PADDING number The size of medium padding.
MIN_BLOCK_HEIGHT number
MIN_BLOCK_WIDTH number The minimum width of the block.
NO_PADDING number The size of an empty spacer.
NOTCH_HEIGHT number The height of the notch used for previous and next connections.
NOTCH_OFFSET_LEFT number Offset from the left side of a block or the inside of a statement input to the left side of the notch.
NOTCH_WIDTH number The width of the notch used for previous and next connections.
NOTCH Notch
OUTSIDE_CORNERS OutsideCorners
PUZZLE_TAB PuzzleTab
SHAPES { [key: string]: number; }
SMALL_PADDING number The size of small padding.
SPACER_DEFAULT_HEIGHT number
START_HAT_HEIGHT number Height of the top hat.
START_HAT_WIDTH number Width of the top hat.
START_HAT StartHat
START_POINT string
STATEMENT_BOTTOM_SPACER number
STATEMENT_INPUT_NOTCH_OFFSET number
STATEMENT_INPUT_PADDING_LEFT number
TAB_HEIGHT number The height of the puzzle tab used for input and output connections.
TAB_OFFSET_FROM_TOP number The offset from the top of the block at which a puzzle tab is positioned.
TAB_VERTICAL_OVERLAP number Vertical overlap of the puzzle tab, used to make it look more like a puzzle piece.
TAB_WIDTH number The width of the puzzle tab used for input and output connections.
TALL_INPUT_FIELD_OFFSET_Y number
TOP_ROW_MIN_HEIGHT number
TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT number

Methods

Method Modifiers Description
createBlockStyle_(colour) protected Create a block style object based on the given colour.
generateSecondaryColour_(inputColour) protected Generate a secondary colour from the passed in primary colour.
generateTertiaryColour_(inputColour) protected Generate a tertiary colour from the passed in primary colour.
getBlockStyle(blockStyleName) Gets the BlockStyle for the given block style name.
getCSS_(selector) protected Get any renderer specific CSS to inject when the renderer is initialized.
injectCSS_(tagName, selector) protected Inject renderer specific CSS into the page.
setComponentConstants_(theme) protected Set constants from a theme's component styles.
setDynamicProperties_(theme) protected Sets dynamic properties that depend on other values or theme properties.
setFontConstants_(theme) protected Set constants related to fonts.
validatedBlockStyle_(blockStyle) protected Get a full block style object based on the input style object. Populate any missing values.