blockly > blockRendering > ConstantProvider

blockRendering.ConstantProvider class

An object that provides constants for rendering blocks.

Signature:

export declare class ConstantProvider 

Constructors

Constructor Modifiers Description
(constructor)() Constructs a new instance of 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.
blockStyles { [key: string]: BlockStyle; }
BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT number
BOTTOM_ROW_MIN_HEIGHT number
CORNER_RADIUS number Rounded corner radius.
CURSOR_BLOCK_PADDING number Padding around a block.
CURSOR_COLOUR string Cursor colour.
CURSOR_STACK_PADDING number Padding around a stack.
CURSOR_STROKE_WIDTH number Stroke of the cursor.
CURSOR_WS_WIDTH number Width of the horizontal cursor.
debugFilterId string The ID of the debug filter, or the empty string if no pattern is set.
disabledPatternId string The ID of the disabled pattern, or the empty string if no pattern is set.
DUMMY_INPUT_MIN_HEIGHT number
DUMMY_INPUT_SHADOW_MIN_HEIGHT number
embossFilterId string The ID of the emboss filter, or the empty string if no filter is set.
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_COLOUR string The backing colour of a field's border rect.
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.
FULL_BLOCK_FIELDS boolean Whether text input and colour fields fill up the entire source block.
INSERTION_MARKER_COLOUR string 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 number The insertion marker opacity.
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.
MARKER_COLOUR string Immovable marker colour.
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
randomIdentifier string
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
WS_CURSOR_HEIGHT number Height of the horizontal cursor.

Methods

Method Modifiers Description
createBlockStyle_(colour) protected Create a block style object based on the given colour.
createDom(svg, tagName, selector) Create any DOM elements that this renderer needs (filters, patterns, etc).
dispose() Dispose of this constants provider. Delete all DOM elements that this provider created.
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.
getBlockStyleForColour(colour) Get or create a block style based on a single colour value. Generate a name for the style based on the colour.
getCSS_(selector) protected Get any renderer specific CSS to inject when the renderer is initialized.
init() Initialize shape objects based on the constants set in the constructor.
injectCSS_(tagName, selector) protected Inject renderer specific CSS into the page.
makeInsideCorners() protected
makeJaggedTeeth() protected
makeNotch() protected
makeOutsideCorners() protected
makePuzzleTab() protected
makeStartHat() protected
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.
setTheme(theme) Refresh constants properties that depend on the theme.
shapeFor(connection) Get an object with connection shape and sizing information based on the type of the connection.
validatedBlockStyle_(blockStyle) protected Get a full block style object based on the input style object. Populate any missing values.