Skip to main content

blockly > blockRendering > RenderInfo > getElemCenterline_

blockRendering.RenderInfo.getElemCenterline_() method

Calculate the centerline of an element in a rendered row. This base implementation puts the centerline at the middle of the row vertically, with no special cases. You will likely need extra logic to handle (at minimum) top and bottom rows.

Signature:

protected getElemCenterline_(row: Row, elem: Measurable): number;

Parameters

Parameter

Type

Description

row

Row

The row containing the element.

elem

Measurable

The element to place.

Returns:

number

The desired centerline of the given element, as an offset from the top left of the block.