react-sync-board 1.4.3 → 1.4.5

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.
package/README.md CHANGED
@@ -70,3 +70,41 @@ npm start
70
70
  ```
71
71
 
72
72
  Remember to start a `wire.io` instance as explained above.
73
+
74
+ ### Movement grids
75
+
76
+ Set `boardConfig.grid` through `useBoardConfig()` and optionally set `item.grid`:
77
+
78
+ ```js
79
+ { type: "grid", size: 50, offset: { x: 0, y: 0 }, show: true,
80
+ color: "#000000", opacity: 0.2 }
81
+ ```
82
+
83
+ Types are `grid` (square intersections), `hexH` (horizontal rows of hex centers),
84
+ and `hexV` (vertical columns of hex centers). Square size is the spacing; hex size
85
+ is the circumradius. Sizes must be positive and finite (invalid/missing sizes
86
+ use 1). Offsets are board-relative and each missing/invalid axis uses zero.
87
+ Numeric strings are accepted. A recognized item grid overrides the board grid;
88
+ otherwise the item inherits it. No active type on either means no snapping.
89
+ Legacy board fields are not interpreted; applications should migrate saved data
90
+ before loading the board.
91
+
92
+ `useItemActions().placeItems(itemIds)` resolves the current board grid internally.
93
+ Dragging snaps on release; keyboard placement and insertion use the same path.
94
+ Item centers use measured border-box dimensions, independent of camera zoom.
95
+ Linked-item placement behavior is unchanged.
96
+
97
+ Render the overlay inside the board:
98
+
99
+ ```jsx
100
+ <Board itemTemplates={itemTemplates}>
101
+ <BoardGridOverlay preview={editingItems} />
102
+ </Board>
103
+ ```
104
+
105
+ Import `BoardGridOverlay` from `react-sync-board`. With `preview={false}` (the
106
+ default), selected items show their effective grid while moving only when
107
+ `grid.show` is true. Preview forces custom item grids visible, including when
108
+ stationary or `show` is false. Inherited grids continue to follow board visibility.
109
+
110
+ See [the browser regressions](tests/browser/README.md) for local verification.