@weasel-js/guides 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,463 @@
1
+ import { RefObject } from 'react';
2
+ import { ViewTransform, UnitValue, UnitSystem, Stroke, RenderLayer, FillStyle, SnapStrategy, DebugSink, OriginProjection, ModifierState, Bounds, PoseDescriptor, InsertBehavior, MoveBehavior, BoundsConstraint, LayoutSnap, LayoutStrategy, Vec2 } from '@weasel-js/core';
3
+ export { p as pointSnapToGrid } from './pointSnapToGrid-BaVEjV23.js';
4
+ import { G as Guide } from './types-D2tTKEU0.js';
5
+
6
+ /** Round `value` to the nearest multiple of `cellSize`. Returns 0 when the result would be -0. */
7
+ declare function roundToCell(value: number, cellSize: number): number;
8
+
9
+ /**
10
+ * Pointer-tracking glue that turns hover position into a grid cell, suitable
11
+ * for dropping straight into `createCellHighlightLayer({ getCell })`. Pairs
12
+ * with `gridSnapStrategy` / `createGridLayer` so the visual hover preview
13
+ * uses the exact same spacing as the snap behavior.
14
+ *
15
+ * Wires three things you'd otherwise glue by hand:
16
+ * 1. pointermove on a target element → client coords
17
+ * 2. client coords → world coords via your `ViewTransform`
18
+ * 3. world coords → integer `{col, row}` via `pointToGridCell`
19
+ *
20
+ * State updates only fire when the cell actually changes (not on every
21
+ * pointer tick). Pass `onChange` to trigger a canvas redraw on each transition.
22
+ */
23
+
24
+ /** Options for `useGridCellHover`. */
25
+ interface UseGridCellHoverOptions {
26
+ /** Element to attach pointer listeners to (typically the canvas). */
27
+ ref: RefObject<HTMLElement | null>;
28
+ /** Read the current view transform. Called on every pointermove so it can
29
+ * reflect live pan/zoom without a re-binding step. */
30
+ view: () => ViewTransform;
31
+ /** Cell spacing in world units. Same value you pass to `createGridLayer`
32
+ * and `createCellHighlightLayer`. */
33
+ spacing: UnitValue;
34
+ /** Required if `spacing` is tagged (e.g. `{ value: 1, unit: 'ft' }`). */
35
+ unitSystem?: UnitSystem;
36
+ /** Origin the cell grid is anchored to, in world units. Default `(0, 0)`. */
37
+ origin?: {
38
+ x: number;
39
+ y: number;
40
+ };
41
+ /** Fires when the hovered cell changes (including to/from `null`). Use it
42
+ * to invalidate your layer renderer. */
43
+ onChange?: (cell: {
44
+ col: number;
45
+ row: number;
46
+ } | null) => void;
47
+ /** Disable the listeners without unmounting. Default `true`. */
48
+ enabled?: boolean;
49
+ }
50
+ /** Return shape of `useGridCellHover`. */
51
+ interface UseGridCellHoverReturn {
52
+ /** Current hovered cell, or `null` when the pointer is outside the element. */
53
+ cell: {
54
+ col: number;
55
+ row: number;
56
+ } | null;
57
+ /** Stable callback that returns the current cell — drop straight into
58
+ * `createCellHighlightLayer({ getCell })`. */
59
+ getCell: () => {
60
+ col: number;
61
+ row: number;
62
+ } | null;
63
+ }
64
+ /** Track which grid cell the pointer is over; pairs with `createCellHighlightLayer`. */
65
+ declare function useGridCellHover(opts: UseGridCellHoverOptions): UseGridCellHoverReturn;
66
+
67
+ /**
68
+ * Grid overlay — a reusable render layer that draws a world-space grid with
69
+ * optional finer subdivisions and accent lines every N cells.
70
+ *
71
+ * The layer renders in world space — the caller is expected to have applied
72
+ * any view transform to the canvas context already. To draw a highlighted
73
+ * cell (snap-target preview), stack `createCellHighlightLayer` alongside
74
+ * this one.
75
+ */
76
+
77
+ /** Options for `createGridLayer`. */
78
+ interface GridLayerOpts {
79
+ /**
80
+ * Distance between adjacent grid lines (also known as grid pitch),
81
+ * in world (base) units. Accepts a bare number or a tagged
82
+ * `{ value, unit }`. Tagged values require `unitSystem` to be supplied.
83
+ */
84
+ spacing: UnitValue;
85
+ /** Optional unit system for resolving tagged `spacing` values. */
86
+ unitSystem?: UnitSystem;
87
+ /** Bounds of the area to cover, in world units. */
88
+ bounds: () => {
89
+ x: number;
90
+ y: number;
91
+ width: number;
92
+ height: number;
93
+ };
94
+ /** Lines every N cells get the accent style. 0/undef = no accent. */
95
+ accentEvery?: number;
96
+ /** Optional finer subdivisions per cell. e.g. 4 -> 4 sub-lines per cell. */
97
+ subdivisions?: number;
98
+ /** Per-band stroke styles. Each is a FillStyle+width (etc.) — see `Stroke`. */
99
+ style?: {
100
+ line?: Stroke;
101
+ accent?: Stroke;
102
+ sub?: Stroke;
103
+ };
104
+ }
105
+ /** Build a `RenderLayer` that draws a world-space grid with optional accent lines and subdivisions. */
106
+ declare function createGridLayer(opts: GridLayerOpts): RenderLayer<unknown>;
107
+
108
+ /**
109
+ * Cell highlight overlay — a thin render layer that fills a single grid cell
110
+ * (e.g. a snap-target preview). Stack it under or over `createGridLayer` in
111
+ * a layer sequence.
112
+ */
113
+
114
+ /** Options for `createCellHighlightLayer`. */
115
+ interface CellHighlightLayerOpts {
116
+ /** Cell size in world units (matches the grid's `spacing`). */
117
+ spacing: UnitValue;
118
+ /** Optional unit system for resolving tagged `spacing` values. */
119
+ unitSystem?: UnitSystem;
120
+ /** Origin the cell grid is anchored to, in world units. Defaults to (0,0). */
121
+ origin?: () => {
122
+ x: number;
123
+ y: number;
124
+ };
125
+ /** Cell to highlight, or `null` to skip drawing. */
126
+ getCell: () => {
127
+ col: number;
128
+ row: number;
129
+ } | null;
130
+ /** FillStyle strategy for the filled cell. Defaults to a soft green. */
131
+ fill?: FillStyle;
132
+ }
133
+ /** Build a `RenderLayer` that fills a single grid cell — typically a snap-target preview. */
134
+ declare function createCellHighlightLayer(opts: CellHighlightLayerOpts): RenderLayer<unknown>;
135
+
136
+ /** Snap-strategy that rounds the pose's origin to the nearest multiple of
137
+ * `spacing` (resolved through `unitSystem`). For non-rect TPose pass an
138
+ * `OriginProjection` so the strategy knows how to read/write the origin. */
139
+ declare function gridSnapStrategy<TPose>(spacing: UnitValue, unitSystem?: UnitSystem): SnapStrategy<TPose>;
140
+ /** As above, additionally reporting each candidate to a debug sink. */
141
+ declare function gridSnapStrategy<TPose>(spacing: UnitValue, opts: {
142
+ unitSystem?: UnitSystem;
143
+ debug?: DebugSink;
144
+ }): SnapStrategy<TPose>;
145
+ /** As above, for a `TPose` that is not a rect: `origin` tells the strategy how
146
+ * to read and write the pose's origin. */
147
+ declare function gridSnapStrategy<TPose>(spacing: UnitValue, opts: {
148
+ unitSystem?: UnitSystem;
149
+ origin: OriginProjection<TPose>;
150
+ debug?: DebugSink;
151
+ }): SnapStrategy<TPose>;
152
+ /**
153
+ * Compute the integer cell `{col, row}` that contains `point`, given a grid
154
+ * `spacing` and optional `origin` and `unitSystem`. Pair with
155
+ * `createCellHighlightLayer` (its `getCell` callback) to draw a snap-target
156
+ * preview that uses the same spacing as `gridSnapStrategy` — so the visual
157
+ * and behavioral grids stay in lockstep:
158
+ *
159
+ * const SPACING = 20;
160
+ * const snap = gridSnapStrategy(SPACING);
161
+ * // visual grid:
162
+ * createGridLayer({ spacing: SPACING, bounds: () => ... });
163
+ * // hover-preview overlay:
164
+ * createCellHighlightLayer({
165
+ * spacing: SPACING,
166
+ * getCell: () => hoverPoint && pointToGridCell(hoverPoint, SPACING),
167
+ * });
168
+ */
169
+ declare function pointToGridCell(point: {
170
+ x: number;
171
+ y: number;
172
+ }, spacing: UnitValue, unitSystem?: UnitSystem, origin?: {
173
+ x: number;
174
+ y: number;
175
+ }): {
176
+ col: number;
177
+ row: number;
178
+ };
179
+
180
+ /** Return shape for `useGuides`. */
181
+ interface UseGuidesReturn {
182
+ /** Live list (state). Re-renders when guides change. */
183
+ guides: Guide[];
184
+ /** Stable getter; reads the latest list without forcing a re-render.
185
+ * Pass to `guideSnapStrategy` and `createGuidesLayer`. */
186
+ getGuides: () => Guide[];
187
+ /** Add a guide. If a guide with the same id already exists it is replaced. */
188
+ addGuide: (guide: Guide) => void;
189
+ /** Remove a guide by id. No-op when missing. */
190
+ removeGuide: (id: string) => void;
191
+ /** Drop all guides. */
192
+ clearGuides: () => void;
193
+ }
194
+ /**
195
+ * In-memory guide storage. Holds a list of horizontal/vertical world-space
196
+ * lines that callers can pass to `guideSnapStrategy` (snap behavior) and
197
+ * `createGuidesLayer` (render layer).
198
+ *
199
+ * v1 is intentionally minimal: no undo integration, no persistence, no
200
+ * batched mutation. Wrap calls in your own history-aware action if you
201
+ * want guide CRUD to be undoable.
202
+ */
203
+ declare function useGuides(initial?: Guide[]): UseGuidesReturn;
204
+
205
+ /**
206
+ * Guides overlay — a screen-space render layer that draws each guide as a
207
+ * thin line spanning the full canvas, projecting the guide's world offset
208
+ * through the active view.
209
+ *
210
+ * Guides are not scene objects; they live outside the scene and are managed
211
+ * via `useGuides`. Pair with `guideSnapStrategy` (snap behavior) to keep
212
+ * the visual guide and the snap target in lockstep.
213
+ */
214
+
215
+ /** Options for `createGuidesLayer`. */
216
+ interface GuidesLayerOpts {
217
+ /** Stable getter for the live guide list — typically `useGuides().getGuides`. */
218
+ getGuides: () => readonly Guide[];
219
+ /** Stroke width in CSS pixels. Default 1. */
220
+ lineWidth?: number;
221
+ /** Stroke color. Default a subtle blue. */
222
+ color?: string;
223
+ /** Optional dash pattern (CSS px). Currently unused — reserved for future
224
+ * parity with chrome that supports dashes. */
225
+ dash?: number[];
226
+ /** Override the layer id. Useful if a consumer needs more than one
227
+ * guides-layer (e.g. user-guides vs. system-guides). */
228
+ id?: string;
229
+ /** Override the layer label. */
230
+ label?: string;
231
+ }
232
+ /** Build a `RenderLayer` that draws guide lines across the full canvas in
233
+ * screen space, projected from world offsets via the active view. */
234
+ declare function createGuidesLayer(opts: GuidesLayerOpts): RenderLayer<unknown>;
235
+
236
+ /** Which feature of a box to test against candidates, per axis.
237
+ * 'min' = left/top edge, 'center' = centerline, 'max' = right/bottom edge. */
238
+ type AlignAnchor = 'min' | 'center' | 'max';
239
+ /** The correction an alignment match asks for: the translation that lands the
240
+ * dragged bounds on the matched guides, and the guides themselves so they can
241
+ * be drawn. */
242
+ interface AlignMatchResult {
243
+ dx: number;
244
+ dy: number;
245
+ activeX: Guide | null;
246
+ activeY: Guide | null;
247
+ }
248
+ /** Which candidate lines to derive from a set of poses — edges, centers, or
249
+ * both, and whether the page box contributes its own. */
250
+ interface DeriveAlignmentGuidesOptions<TPose = Bounds> {
251
+ /** Include the document/page box's edges + center as candidates. */
252
+ page?: Bounds;
253
+ /** Emit left/right (x) and top/bottom (y) edge guides. Default true. */
254
+ edges?: boolean;
255
+ /** Emit centerX (x) and centerY (y) guides. Default true. */
256
+ centers?: boolean;
257
+ /** How to read each target. Pass the same descriptor `alignMoveBehavior`
258
+ * gets, or the two sides disagree. Default `AUTO_POSE_DESCRIPTOR`. */
259
+ poseDescriptor?: PoseDescriptor<TPose>;
260
+ }
261
+ /** Common options shared by the three alignment behavior factories. */
262
+ interface AlignmentBehaviorBase {
263
+ /** Live candidate lines — consumer derives from current siblings + page. */
264
+ getCandidates: () => readonly Guide[];
265
+ /** Publish the currently-matched line(s). Called every onMove; cleared
266
+ * (`[]`) on a miss and on onEnd. */
267
+ setActiveGuides: (guides: readonly Guide[]) => void;
268
+ /** Tolerance in screen px, read through the gesture's view. Default 6. */
269
+ tolerance?: number;
270
+ /** Modifier key that bypasses snapping while held. */
271
+ bypassKey?: keyof ModifierState;
272
+ }
273
+
274
+ /** Derive candidate alignment lines from a set of sibling poses plus an
275
+ * optional page box. Each box contributes up to 3 guides per axis: the two
276
+ * edges and the center. Overlapping offsets collapse to one candidate.
277
+ * Poses go through the same descriptor `alignMoveBehavior` matches with, so
278
+ * a rotated sibling advertises its ink edges rather than its stored box. */
279
+ declare function deriveAlignmentGuides<TPose = Bounds>(targets: readonly TPose[], opts?: DeriveAlignmentGuidesOptions<TPose>): Guide[];
280
+
281
+ /** Move/insert test all three features per axis. */
282
+ declare const MOVE_ANCHORS: {
283
+ x: readonly AlignAnchor[];
284
+ y: readonly AlignAnchor[];
285
+ };
286
+ /**
287
+ * Match a moving box's selected edge/center features against candidate guide
288
+ * lines. Returns the per-axis snap delta and the matched candidate line(s).
289
+ * The two axes resolve independently; on each axis the closest in-tolerance
290
+ * (feature, candidate) pair wins.
291
+ *
292
+ * `worldTolerance` is per axis because a screen-pixel tolerance is not one
293
+ * world distance under non-uniform zoom — and each axis here is matched by a
294
+ * distance along that axis alone, so there is an exact answer rather than an
295
+ * approximation. Pass the same number twice for a world-space tolerance.
296
+ */
297
+ declare function matchAlignment(bounds: Bounds, candidates: readonly Guide[], worldTolerance: {
298
+ x: number;
299
+ y: number;
300
+ }, anchors: {
301
+ x: readonly AlignAnchor[];
302
+ y: readonly AlignAnchor[];
303
+ }): AlignMatchResult;
304
+
305
+ /** Options for move and resize — adds the pose descriptor for non-rect poses. */
306
+ interface AlignMoveArgs<TPose> extends AlignmentBehaviorBase {
307
+ poseDescriptor?: PoseDescriptor<TPose>;
308
+ }
309
+ /** Move behavior: snap the dragged selection's union box (edges + center) to
310
+ * candidates, shaping the proposed translate. The gesture applies the
311
+ * transform uniformly to every dragged id, so the selection shifts together
312
+ * and stays rigid. Single-select is the degenerate one-box union. Publishes
313
+ * the matched line(s); clears on miss, end and cancel. */
314
+ declare function alignMoveBehavior<TPose>(args: AlignMoveArgs<TPose>): MoveBehavior<TPose>;
315
+ /** Insert behavior: snap the live `current` point to candidates (treating it
316
+ * as a zero-size box). Publishes the matched line(s). */
317
+ declare function alignInsertBehavior<TPose>(args: AlignmentBehaviorBase): InsertBehavior<TPose>;
318
+ /** Resize constraint: snap the corner(s) the drag moves, as drawn, to
319
+ * candidates; the pinned corner stays fixed. On an unrotated pose that is
320
+ * the moving edge(s). On a rotated one the node's own axes set how the
321
+ * corner can travel: a corner handle snaps each world axis, an edge handle
322
+ * slides its edge until the nearer of its two corners meets a line.
323
+ * `poseDescriptor` reads the origin pose's box and rotation, and must match
324
+ * the resize action's. Publishes the matched line(s). */
325
+ declare function alignResizeBehavior<TPose extends Bounds>(args: AlignMoveArgs<TPose>): BoundsConstraint<TPose>;
326
+
327
+ /** Default snap tolerance (screen pixels). */
328
+ declare const DEFAULT_GUIDE_TOLERANCE_PX = 6;
329
+ /** Options for `guideSnapStrategy`. */
330
+ interface GuideSnapOptions<TPose> {
331
+ /**
332
+ * Tolerance in screen pixels, divided by the gesture view's scale so the
333
+ * trigger zone stays the same on screen at every zoom. Defaults to
334
+ * `DEFAULT_GUIDE_TOLERANCE_PX`.
335
+ */
336
+ tolerance?: number;
337
+ /**
338
+ * Projection used when `TPose` doesn't expose `{x, y}` directly (Path,
339
+ * polygon, etc.) — same contract as `gridSnapStrategy`. Defaults to the
340
+ * rect-pose identity projection.
341
+ */
342
+ origin?: OriginProjection<TPose>;
343
+ }
344
+ /**
345
+ * Snap-strategy that snaps the pose's origin to the nearest guide line on
346
+ * each axis when within tolerance. Each axis is considered independently:
347
+ * a vertical guide (`axis: 'x'`) constrains X, a horizontal guide
348
+ * (`axis: 'y'`) constrains Y. When multiple guides are within range on the
349
+ * same axis, the closest wins.
350
+ *
351
+ * Pair with `useGuides` for storage and `createGuidesLayer` for rendering.
352
+ *
353
+ * **Composition:** combining with `gridSnapStrategy` is left to the
354
+ * consumer in v1 — typically by picking one based on a modifier key, or
355
+ * by stacking two move/resize/insert behaviors in priority order.
356
+ */
357
+ declare function guideSnapStrategy<TPose extends {
358
+ x: number;
359
+ y: number;
360
+ }>(getGuides: () => readonly Guide[], options?: Omit<GuideSnapOptions<TPose>, 'origin'>): SnapStrategy<TPose>;
361
+ /** As above, for a `TPose` that is not a rect: `origin` tells the strategy how
362
+ * to read and write the pose's origin. */
363
+ declare function guideSnapStrategy<TPose>(getGuides: () => readonly Guide[], options: GuideSnapOptions<TPose> & {
364
+ origin: OriginProjection<TPose>;
365
+ }): SnapStrategy<TPose>;
366
+
367
+ /** Snap policy that never picks a target — every drop is rejected, which is
368
+ * what a free-form container wants. */
369
+ declare function none<TPose>(): LayoutSnap<TPose>;
370
+ /** Snap policy that always picks the target closest to the pointer, however
371
+ * far away it is. */
372
+ declare function nearest<TPose>(): LayoutSnap<TPose>;
373
+ /** Snap policy that picks the closest target, but only within `tolerance`
374
+ * world units — beyond that the drop is rejected. */
375
+ declare function nearestWithin<TPose>(opts: {
376
+ tolerance: number;
377
+ }): LayoutSnap<TPose>;
378
+ /**
379
+ * Region-aware snap. If the pointer falls inside any target's `hitBounds`,
380
+ * that target wins; otherwise falls back to nearest-origin. Useful for
381
+ * strategies whose targets are area-shaped (gutters, drop-zones, gridded
382
+ * cells) rather than point-shaped.
383
+ *
384
+ * Pointer-in-multiple-bounds order: first match in iteration order wins, so
385
+ * strategies should emit narrower/more-specific targets before broader ones
386
+ * (e.g. row-gutter before tray-corner).
387
+ */
388
+ declare function containedThenNearest<TPose>(): LayoutSnap<TPose>;
389
+ /**
390
+ * Backwards-compatible cell snap. Prefer `containedThenNearest` for new
391
+ * strategies; this variant remains for `tileGrid` and any caller that puts
392
+ * its cell rect in `meta.cellRect` rather than `hitBounds`.
393
+ */
394
+ declare function cellAt<TPose>(): LayoutSnap<TPose>;
395
+
396
+ /** Options for `freeform`. */
397
+ interface FreeformOptions<TPose> {
398
+ snap?: LayoutSnap<TPose>;
399
+ }
400
+ /**
401
+ * Identity layout: each child stays where it's stored, no reflow, no drop
402
+ * targets. `snap` is accepted for API symmetry — overrides take effect only
403
+ * if a caller wires up an external drop-target source, since `getDropTargets`
404
+ * returns empty by default.
405
+ */
406
+ declare function freeform<TPose>(opts?: FreeformOptions<TPose>): LayoutStrategy<TPose>;
407
+
408
+ /** Options for `tileGrid`. */
409
+ interface TileGridOptions<TPose> {
410
+ cols: number;
411
+ rows: number;
412
+ /** Gap between cells, in world units. Default 0. */
413
+ gap?: number;
414
+ snap?: LayoutSnap<TPose>;
415
+ /** Optional: map a cell rect + the dragged pose to the new pose. Default
416
+ * writes `{ x, y, width, height }` into the dragged pose (assumes
417
+ * `RectPose`). Override for point-only poses or other shapes. The
418
+ * `dragged` argument is the pre-drop pose of the child being placed —
419
+ * use it to preserve fields the cell rect doesn't carry (e.g. rotation,
420
+ * domain metadata). */
421
+ cellToPose?(cellRect: {
422
+ x: number;
423
+ y: number;
424
+ width: number;
425
+ height: number;
426
+ }, dragged: TPose): TPose;
427
+ /** Optional: the point that decides which cell a child occupies — a child
428
+ * occupies the cell containing it. Default reads `x`/`y` plus half of
429
+ * `width`/`height` when the pose has them, which is the center of a
430
+ * `RectPose` and the point itself for a point pose. */
431
+ centerOf?(pose: TPose): {
432
+ x: number;
433
+ y: number;
434
+ };
435
+ }
436
+ /**
437
+ * Layout strategy that arranges children into a fixed grid of cells, one
438
+ * child per cell, and the container holds at most `cols × rows` children.
439
+ *
440
+ * A child occupies the cell its pose sits in (see `centerOf`). A drag from
441
+ * inside the container swaps with the child in the cell it lands on; a drop
442
+ * from outside is offered only the free cells, so it lands in the nearest
443
+ * free one and a full grid rejects it.
444
+ */
445
+ declare function tileGrid<TPose>(opts: TileGridOptions<TPose>): LayoutStrategy<TPose>;
446
+
447
+ /** Which points within a container a child can snap to. */
448
+ type SnapPattern = 'corners' | 'edges' | 'center' | 'grid';
449
+ /** Options for `snapPoint`. */
450
+ interface SnapPointOptions<TPose> {
451
+ pattern: SnapPattern;
452
+ /** Spacing for the 'grid' pattern, in world units. Default 50. */
453
+ gridSpacing?: number;
454
+ /** Tolerance for the default snap policy (nearestWithin). Default Infinity. */
455
+ tolerance?: number;
456
+ snap?: LayoutSnap<TPose>;
457
+ }
458
+ /** Layout strategy that leaves children where they are but offers a fixed set
459
+ * of points — corners, edge midpoints, center, or a grid — for a dragged
460
+ * child to land on. */
461
+ declare function snapPoint<TPose extends Vec2>(opts: SnapPointOptions<TPose>): LayoutStrategy<TPose>;
462
+
463
+ export { type AlignAnchor, type AlignMatchResult, type AlignMoveArgs, type AlignmentBehaviorBase, type CellHighlightLayerOpts, DEFAULT_GUIDE_TOLERANCE_PX, type DeriveAlignmentGuidesOptions, type FreeformOptions, type GridLayerOpts, Guide, type GuideSnapOptions, type GuidesLayerOpts, MOVE_ANCHORS, type SnapPattern, type SnapPointOptions, type TileGridOptions, type UseGridCellHoverOptions, type UseGridCellHoverReturn, type UseGuidesReturn, alignInsertBehavior, alignMoveBehavior, alignResizeBehavior, cellAt, containedThenNearest, createCellHighlightLayer, createGridLayer, createGuidesLayer, deriveAlignmentGuides, freeform, gridSnapStrategy, guideSnapStrategy, matchAlignment, nearest, nearestWithin, none, pointToGridCell, roundToCell, snapPoint, tileGrid, useGridCellHover, useGuides };