Skip to main content

Home > blockly > Workspace > sortByOrigin

Workspace.sortByOrigin() method

Sorts bounded elements on the workspace by their relative position, top to bottom (with slight LTR or RTL bias).

Signature:

protected sortByOrigin(a: IBoundedElement, b: IBoundedElement): number;

Parameters

ParameterTypeDescription
aIBoundedElementThe first element to sort.
bIBoundedElementThe second elment to sort.

Returns:

number

-1, 0 or 1 depending on the sort order.