Skip to main content

Home > blockly > blockRendering > Drawer

blockRendering.Drawer class

An object that draws a block based on the given rendering information.

Signature:

export declare class Drawer 

Constructors

ConstructorModifiersDescription
(constructor)(block, info)Constructs a new instance of the Drawer class

Properties

PropertyModifiersTypeDescription
block_BlockSvg
constants_protectedConstantProvider
info_RenderInfo
inlinePath_string
outlinePath_string
topLeft_Coordinate

Methods

MethodModifiersDescription
draw()Draw the block to the workspace. Here "drawing" means setting SVG path elements and moving fields, icons, and connections on the screen. The pieces of the paths are pushed into arrays of "steps", which are then joined with spaces and set directly on the block. This guarantees that the steps are separated by spaces for improved readability, but isn't required.
drawBottom_()protectedAdd steps for the bottom edge of a block, possibly including a notch for the next connection.
drawConnectionHighlightPath(measurable)Returns a path to highlight the given connection.
drawInlineInput_(input)protectedAdd steps for an inline input.
drawInternals_()protectedDraw the internals of the block: inline inputs, fields, and icons. These do not depend on the outer path for placement.
drawJaggedEdge_(row)protectedAdd steps for the jagged edge of a row on a collapsed block.
drawLeft_()protectedAdd steps for the left side of the block, which may include an output connection
drawOutline_()protectedCreate the outline of the block. This is a single continuous path.
drawRightSideRow_(row)protectedAdd steps for the right side of a row that does not have value or statement input connections.
drawStatementInput_(row)protectedAdd steps for a statement input.
drawTop_()protectedAdd steps for the top corner of the block, taking into account details such as hats and rounded corners.
drawValueInput_(row)protectedAdd steps for an external value input, rendered as a notch in the side of the block.
layoutField_(fieldInfo)protectedPush a field or icon's new position to its SVG root.
positionExternalValueConnection_(row)protectedPosition the connection on an external value input, taking into account RTL and the small gap between the parent block and child block which lets the parent block's dark path show through.
positionInlineInputConnection_(input)protectedPosition the connection on an inline value input, taking into account RTL and the small gap between the parent block and child block which lets the parent block's dark path show through.
positionNextConnection_()protectedPosition the next connection on a block.
positionOutputConnection_()protectedPosition the output connection on a block.
positionPreviousConnection_()protectedPosition the previous connection on a block.
positionStatementInputConnection_(row)protectedPosition the connection on a statement input, taking into account RTL and the small gap between the parent block and child block which lets the parent block's dark path show through.
recordSizeOnBlock_()protectedSave sizing information back to the block Most of the rendering information can be thrown away at the end of the render. Anything that needs to be kept around should be set in this function.
updateConnectionHighlights()protectedUpdates the path object to reflect which connections on the block are highlighted.