snap#

Interfaces#

Box#

Defined in: arranger/src/snap.ts:7

A block’s box on the canvas.

Properties#

height#

readonly height: number

Defined in: arranger/src/snap.ts:12

id#

readonly id: string

Defined in: arranger/src/snap.ts:8

origin#

readonly origin: number

Defined in: arranger/src/snap.ts:14

The canvas x of the start of the root’s line.

width#

readonly width: number

Defined in: arranger/src/snap.ts:11

x#

readonly x: number

Defined in: arranger/src/snap.ts:9

y#

readonly y: number

Defined in: arranger/src/snap.ts:10


Guide#

Defined in: arranger/src/snap.ts:18

A line drawn while a block is aligned to it.

Properties#

at#

readonly at: number

Defined in: arranger/src/snap.ts:20

axis#

readonly axis: "x"

Defined in: arranger/src/snap.ts:19

Functions#

snap()#

snap(moving, others, grid, tolerance): object

Defined in: arranger/src/snap.ts:31

Where moving lands: its position quantized to the grid (or to GRID_FREE when it does not snap), then, horizontally, its left edge or its origin moved onto the nearest left edge or origin of others lying within tolerance canvas units, with a guide there. On a tie the first wins: in the order of others, a left edge before an origin, the moving left edge before its origin. An aligned x is quantized to GRID_FREE.

Parameters#

moving#

Box

others#

readonly Box[]

grid#
size#

number

snap#

boolean

tolerance#

number

Returns#

object

guides#

guides: readonly Guide[]

x#

x: number

y#

y: number