@grafloria/element 0.4.24 → 0.4.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafloria/element",
3
- "version": "0.4.24",
3
+ "version": "0.4.25",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -1706,6 +1706,19 @@ export function bindDashboardGrid(api, group, options = {}) {
1706
1706
  // ratchet's second disguise (grow committed; a fresh shrink gesture could
1707
1707
  // never pull low enough to ask the parent for a row back).
1708
1708
  let h = bottom - top;
1709
+ /**
1710
+ * Did the escalation below move this tile AS PART OF THE STRIP? A
1711
+ * full-height tile shares its row count with every other full-height tile
1712
+ * in the section, so once the strip grew, this tile's height is the
1713
+ * strip's — not whatever its own pixels re-quantise to. Without this the
1714
+ * gesture undid itself for its own tile and left the NEIGHBOUR grown:
1715
+ * drag Churn's bottom 70 px and ORDERS became two rows while Churn stayed
1716
+ * one (reported from the fluid demo). The cause is the row height
1717
+ * changing mid-gesture: 86 px rows make +70 read as 2 rows, and the
1718
+ * moment the section grows, rows become 108 px and the same pixels read
1719
+ * as 1 again. See the sibling rule for the un-pulled axis below.
1720
+ */
1721
+ let stripFollow = false;
1709
1722
  // NESTED HEIGHT ESCALATION (live report: "i cant increase height"). A
1710
1723
  // bounded strip cannot grow a tile taller than itself — so pulling
1711
1724
  // clearly past its bottom GROWS THE STRIP: the slab gains a row in the
@@ -1764,9 +1777,30 @@ export function bindDashboardGrid(api, group, options = {}) {
1764
1777
  // The SAME rounding the resize path quantises with, or the tile shrinks
1765
1778
  // through that path first and the section never gets its row back.
1766
1779
  const wantRows = Math.max(1, Math.round((h + gap) / rowPx));
1767
- const wantsMore = wantRows > pulled.h;
1768
- const wantsLess = wantRows < pulled.h;
1769
1780
  const fullHeight = pulled.y === 0 && pulled.h >= inner;
1781
+ // For the WHOLE gesture, not just the move that escalated: a strip
1782
+ // tile's height is its cells. Set on every move so the tile cannot
1783
+ // re-quantise back a row on the moves in between.
1784
+ stripFollow = fullHeight;
1785
+ /**
1786
+ * A STRIP IS MEASURED FROM THE PRESS, NOT FROM ITSELF. Growing the
1787
+ * strip changes the row height, so quantising the live pixels against
1788
+ * the LIVE row height feeds the decision back into its own input: at
1789
+ * 86 px rows a +80 px pull reads as 2 rows, the section grows, rows
1790
+ * become 108 px, the same pointer now reads as 1 row, the section
1791
+ * shrinks — and the gesture oscillates and lands wherever the last
1792
+ * move left it (measured: +60/+70/+90 grew, +80 did nothing).
1793
+ * Counting rows from the row height AT PRESS is monotonic in the
1794
+ * pointer, so the strip cannot fight itself.
1795
+ */
1796
+ const startCell = g.startCells.get(g.id);
1797
+ const startRowPx = startCell && startCell.h > 0 ? (g.startSize.height + gap) / startCell.h : rowPx;
1798
+ const stripRows = startCell
1799
+ ? Math.max(1, startCell.h + Math.round((h - g.startSize.height) / startRowPx))
1800
+ : wantRows;
1801
+ const effWant = fullHeight ? stripRows : wantRows;
1802
+ const wantsMore = effWant > pulled.h;
1803
+ const wantsLess = effWant < pulled.h;
1770
1804
  const fullOnes = engine.getItems().filter((i) => i.y === 0 && i.h >= inner).map((i) => i.id);
1771
1805
  const resizeAll = (ids, rowsTo) => {
1772
1806
  for (const id of ids) {
@@ -1871,7 +1905,11 @@ export function bindDashboardGrid(api, group, options = {}) {
1871
1905
  // projection of its cell span instead of the start-of-gesture pixels.
1872
1906
  if (!pullsX)
1873
1907
  w = itemNow.w * (cuNow + gap) - gap;
1874
- if (!pullsY)
1908
+ // …and a tile the STRIP just moved follows its cells on the pulled axis
1909
+ // too: the strip is one row of tiles, so the dragged tile keeps the row
1910
+ // count its peers were given rather than re-quantising against the row
1911
+ // height the escalation itself just changed.
1912
+ if (!pullsY || stripFollow)
1875
1913
  h = itemNow.h * (rhNow + gap) - gap;
1876
1914
  }
1877
1915
  // Anchor: the pulled edges follow w/h, the opposite ones stay put — on