AI-generated Key Takeaways
-
The
ConstantProvider
is a collection of magic numbers, shapes, and strings used by various Blockly renderer components and other parts like built-in fields. -
All values within the
ConstantProvider
are expected to remain constant at runtime to avoid rendering bugs. -
The constant provider defines standard shapes for connections, including notches for next and previous connections and puzzle tabs for input and output connections.
-
Connection shapes can be defined dynamically based on their connection checks using the
shapeFor
method. -
The constant provider also defines paths for elements like jagged edges and various values for padding and minimum row heights.
The ConstantProvider
is a collection of magic numbers,
shapes and strings used by all of the other renderer components, as well as
other parts of Blockly like the built-in fields.
All constant values are assumed to be constant! Changing values at runtime causes rendering bugs.
Connection shapes
The constant provider contains definitions for the standard shapes of different
connections. Notch
es define the shapes of next and previous
connections. And the PuzzleTab
s define the shapes of input
and output connections. (These names are based on the shapes provided by
the default renderer.)
Connection shapes based on checks
The constant provider can also define the shapes of connections dynamically
based on their connection check. This is done using the
shapeFor
method.
Other various paths
The constant provider also defines paths for other various parts of the block, like jagged edges for collapsed blocks.
Other various values
And finally, the constant provider also defines various values for things like the padding between different elements, or the minimum heights of rows.