Skip to main content

Home > blockly > blockRendering > ConstantProvider

blockRendering.ConstantProvider class

An object that provides constants for rendering blocks.

Signature:

export declare class ConstantProvider 

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the ConstantProvider class

Properties

PropertyModifiersTypeDescription
ADD_START_HATSbooleanWhether 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_YnumberVertical padding between consecutive statement inputs.
blockStyles{ [key: string]: BlockStyle; }
BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHTnumber
BOTTOM_ROW_MIN_HEIGHTnumber
CORNER_RADIUSnumberRounded corner radius.
CURSOR_BLOCK_PADDINGnumberPadding around a block.
CURSOR_COLOURstringCursor colour.
CURSOR_STACK_PADDINGnumberPadding around a stack.
CURSOR_STROKE_WIDTHnumberStroke of the cursor.
CURSOR_WS_WIDTHnumberWidth of the horizontal cursor.
debugFilterIdstringThe ID of the debug filter, or the empty string if no pattern is set.
disabledPatternIdstringThe ID of the disabled pattern, or the empty string if no pattern is set.
DUMMY_INPUT_MIN_HEIGHTnumber
DUMMY_INPUT_SHADOW_MIN_HEIGHTnumber
embossFilterIdstringThe ID of the emboss filter, or the empty string if no filter is set.
EMPTY_BLOCK_SPACER_HEIGHTnumber
EMPTY_INLINE_INPUT_HEIGHTnumber
EMPTY_INLINE_INPUT_PADDINGnumber
EMPTY_STATEMENT_INPUT_HEIGHTnumber
EXTERNAL_VALUE_INPUT_PADDINGnumber
FIELD_BORDER_RECT_COLOURstringThe backing colour of a field's border rect.
FIELD_BORDER_RECT_HEIGHTnumberA field's border rect default height.
FIELD_BORDER_RECT_RADIUSnumberA field's border rect corner radius.
FIELD_BORDER_RECT_X_PADDINGnumberA field's border rect X padding.
FIELD_BORDER_RECT_Y_PADDINGnumberA field's border rect Y padding.
FIELD_CHECKBOX_X_OFFSETnumber
FIELD_COLOUR_DEFAULT_HEIGHTnumber
FIELD_COLOUR_DEFAULT_WIDTHnumberA colour field's default width.
FIELD_COLOUR_FULL_BLOCKbooleanWhether or not the colour field should display its colour value on the entire block.
FIELD_DROPDOWN_BORDER_RECT_HEIGHTnumber
FIELD_DROPDOWN_COLOURED_DIVbooleanWhether or not a dropdown field's div should be coloured to match the block colours.
FIELD_DROPDOWN_NO_BORDER_RECT_SHADOWbooleanWhether or not a dropdown field should add a border rect when in a shadow block.
FIELD_DROPDOWN_SVG_ARROW_DATAURIstring
FIELD_DROPDOWN_SVG_ARROW_PADDINGnumber
FIELD_DROPDOWN_SVG_ARROW_SIZEnumberA dropdown field's SVG arrow size.
FIELD_DROPDOWN_SVG_ARROWbooleanWhether or not a dropdown field uses a text or SVG arrow.
FIELD_TEXT_BASELINE_CENTERboolean
FIELD_TEXT_BASELINEnumberText baseline. This constant is dynamically set in setFontConstants_ to be the baseline of the text based on the font used.
FIELD_TEXT_FONTFAMILYstringText font family.
FIELD_TEXT_FONTSIZEnumberPoint size of text.
FIELD_TEXT_FONTWEIGHTstringText font weight.
FIELD_TEXT_HEIGHTnumberHeight of text. This constant is dynamically set in setFontConstants_ to be the height of the text based on the font used.
FIELD_TEXTINPUT_BOX_SHADOWbooleanWhether or not to show a box shadow around the widget div. This is only a feature of full block fields.
FULL_BLOCK_FIELDSbooleanWhether text input and colour fields fill up the entire source block.
INSERTION_MARKER_COLOURstringThe main colour of insertion markers, in hex. The block is rendered a transparent grey by changing the fill opacity in CSS.
INSERTION_MARKER_OPACITYnumberThe insertion marker opacity.
INSIDE_CORNERSInsideCorners
JAGGED_TEETH_HEIGHTnumberHeight of SVG path for jagged teeth at the end of collapsed blocks.
JAGGED_TEETH_WIDTHnumberWidth of SVG path for jagged teeth at the end of collapsed blocks.
JAGGED_TEETHJaggedTeeth
LARGE_PADDINGnumberThe size of large padding.
MARKER_COLOURstringImmovable marker colour.
MEDIUM_LARGE_PADDINGnumberThe size of medium-large padding.
MEDIUM_PADDINGnumberThe size of medium padding.
MIN_BLOCK_HEIGHTnumber
MIN_BLOCK_WIDTHnumberThe minimum width of the block.
NO_PADDINGnumberThe size of an empty spacer.
NOTCH_HEIGHTnumberThe height of the notch used for previous and next connections.
NOTCH_OFFSET_LEFTnumberOffset from the left side of a block or the inside of a statement input to the left side of the notch.
NOTCH_WIDTHnumberThe width of the notch used for previous and next connections.
NOTCHNotch
OUTSIDE_CORNERSOutsideCorners
PUZZLE_TABPuzzleTab
randomIdentifierstring
SHAPES{ [key: string]: number; }
SMALL_PADDINGnumberThe size of small padding.
SPACER_DEFAULT_HEIGHTnumber
START_HAT_HEIGHTnumberHeight of the top hat.
START_HAT_WIDTHnumberWidth of the top hat.
START_HATStartHat
START_POINTstring
STATEMENT_BOTTOM_SPACERnumber
STATEMENT_INPUT_NOTCH_OFFSETnumber
STATEMENT_INPUT_PADDING_LEFTnumber
TAB_HEIGHTnumberThe height of the puzzle tab used for input and output connections.
TAB_OFFSET_FROM_TOPnumberThe offset from the top of the block at which a puzzle tab is positioned.
TAB_VERTICAL_OVERLAPnumberVertical overlap of the puzzle tab, used to make it look more like a puzzle piece.
TAB_WIDTHnumberThe width of the puzzle tab used for input and output connections.
TALL_INPUT_FIELD_OFFSET_Ynumber
TOP_ROW_MIN_HEIGHTnumber
TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHTnumber
WS_CURSOR_HEIGHTnumberHeight of the horizontal cursor.

Methods

MethodModifiersDescription
createBlockStyle_(colour)protectedCreate a block style object based on the given colour.
createDom(svg, tagName, selector, injectionDivIfIsParent)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)protectedGenerate a secondary colour from the passed in primary colour.
generateTertiaryColour_(inputColour)protectedGenerate 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)protectedGet 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)protectedInject renderer specific CSS into the page.
makeInsideCorners()protected
makeJaggedTeeth()protected
makeNotch()protected
makeOutsideCorners()protected
makePuzzleTab()protected
makeStartHat()protected
setComponentConstants_(theme)protectedSet constants from a theme's component styles.
setDynamicProperties_(theme)protectedSets dynamic properties that depend on other values or theme properties.
setFontConstants_(theme)protectedSet 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)protectedGet a full block style object based on the input style object. Populate any missing values.