snap#
Interfaces#
Box#
Defined in: arranger/src/snap.ts:7
A block’s box on the canvas.
Properties#
height#
readonlyheight:number
Defined in: arranger/src/snap.ts:12
id#
readonlyid:string
Defined in: arranger/src/snap.ts:8
origin#
readonlyorigin:number
Defined in: arranger/src/snap.ts:14
The canvas x of the start of the root’s line.
width#
readonlywidth:number
Defined in: arranger/src/snap.ts:11
x#
readonlyx:number
Defined in: arranger/src/snap.ts:9
y#
readonlyy: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#
readonlyat:number
Defined in: arranger/src/snap.ts:20
axis#
readonlyaxis:"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#
others#
readonly Box[]
grid#
size#
number
snap#
boolean
tolerance#
number
Returns#
object
guides#
guides: readonly
Guide[]
x#
x:
number
y#
y:
number