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

Parameter Type Description
a IBoundedElement The first element to sort.
b IBoundedElement The second elment to sort.

Returns:

number

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