@grafloria/element 0.4.43 → 0.4.44

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.43",
3
+ "version": "0.4.44",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -1476,13 +1476,36 @@ export function bindDashboardGrid(api, group, options = {}) {
1476
1476
  api.container.style.cursor = cursorFor(edges);
1477
1477
  };
1478
1478
  /**
1479
- * MOVE a section by its caption band or its strip's empty space. A section
1480
- * is a LOCKED tile so that nothing pushes it; for the gesture's duration the
1481
- * tile is unlocked (it is the one moving), other sections stay locked and
1482
- * still refuse it (E4b), and every unlocked tile gets pushed the way a
1483
- * widget pushes it. Its children ride along: the frame moves, the nested
1484
- * board re-projects.
1479
+ * MOVE a section by its caption band, its strip's empty space or its frame
1480
+ * margin. A section is a LOCKED tile so that no WIDGET pushes it; for the
1481
+ * gesture's duration the moving tile is unlocked, and so are the OTHER
1482
+ * member groups (0.4.44): a moved section or group pushes the sections in
1483
+ * its way, the way a dock does. They used to stay locked against it too
1484
+ * (E4b), so the fluid demo's eight-row side panel, with the Operations
1485
+ * section spanning the row beneath it, had no legal column to its left —
1486
+ * the refusal tone at every cell, and the release moved nothing ("I can't
1487
+ * drag the tab group"). Every unlocked tile gets pushed the way a widget
1488
+ * pushes it; a group's children ride along: the frame moves, the nested
1489
+ * board re-projects. The others relock on release.
1485
1490
  */
1491
+ let slabUnlocked = [];
1492
+ const unlockOthersForSlab = (id) => {
1493
+ slabUnlocked = [];
1494
+ for (const o of engine.getItems()) {
1495
+ if (o.id !== id && o.locked && isGroupMember(o.id)) {
1496
+ o.locked = false;
1497
+ slabUnlocked.push(o.id);
1498
+ }
1499
+ }
1500
+ };
1501
+ const relockOthersForSlab = () => {
1502
+ for (const oid of slabUnlocked) {
1503
+ const o = engine.getItem(oid);
1504
+ if (o)
1505
+ o.locked = true;
1506
+ }
1507
+ slabUnlocked = [];
1508
+ };
1486
1509
  const beginSlabMove = (id, ev) => {
1487
1510
  const grp = diagram.getGroup(id);
1488
1511
  const it = engine.getItem(id);
@@ -1491,6 +1514,7 @@ export function bindDashboardGrid(api, group, options = {}) {
1491
1514
  engine.beginGesture();
1492
1515
  const snap = snapshotAll();
1493
1516
  it.locked = false;
1517
+ unlockOthersForSlab(id);
1494
1518
  slabGesture = {
1495
1519
  id,
1496
1520
  edges: NO_EDGES,
@@ -1628,6 +1652,7 @@ export function bindDashboardGrid(api, group, options = {}) {
1628
1652
  releasePointer(g.pointerId);
1629
1653
  api.container.style.cursor = '';
1630
1654
  relockSlab(g.id);
1655
+ relockOthersForSlab();
1631
1656
  if (g.move && g.started)
1632
1657
  setCarried(g.id, false); // exempt through the drop write, then the glides resume
1633
1658
  if (!g.started) {
@@ -1638,7 +1663,20 @@ export function bindDashboardGrid(api, group, options = {}) {
1638
1663
  project();
1639
1664
  const it = engine.getItem(g.id);
1640
1665
  const grp = diagram.getGroup(g.id);
1641
- const commands = buildCommitCommands(deltasSince(g.startCells, g.startGeom, g.id));
1666
+ const deltas = deltasSince(g.startCells, g.startGeom, g.id);
1667
+ const commands = buildCommitCommands(deltas);
1668
+ // The sections and groups the move PUSHED (0.4.44): the tile commit skips
1669
+ // groups by design (a group's cell is its own command), so they are
1670
+ // committed here the way a dock commits the groups it displaced — or the
1671
+ // model snapped every one of them, and the mover, straight back.
1672
+ for (const d of deltas) {
1673
+ if (!d.isGroup || (d.cellBefore.x === d.cellAfter.x && d.cellBefore.y === d.cellAfter.y && d.cellBefore.w === d.cellAfter.w && d.cellBefore.h === d.cellAfter.h))
1674
+ continue;
1675
+ const og = diagram.getGroup(d.id);
1676
+ if (!og)
1677
+ continue;
1678
+ commands.push(new SetGroupCellCommand(d.id, d.cellBefore, d.cellAfter, { x: d.posBefore.x, y: d.posBefore.y, width: d.sizeBefore.width, height: d.sizeBefore.height }, frameOfGroup(og)));
1679
+ }
1642
1680
  const b = g.cellBefore;
1643
1681
  if (it && grp && (b.x !== it.x || b.y !== it.y || b.w !== it.w || b.h !== it.h)) {
1644
1682
  commands.push(new SetGroupCellCommand(g.id, b, { x: it.x, y: it.y, w: it.w, h: it.h }, g.frameBefore, frameOfGroup(grp)));
@@ -1658,6 +1696,7 @@ export function bindDashboardGrid(api, group, options = {}) {
1658
1696
  releasePointer(g.pointerId);
1659
1697
  api.container.style.cursor = '';
1660
1698
  relockSlab(g.id);
1699
+ relockOthersForSlab();
1661
1700
  if (g.move && g.started)
1662
1701
  setCarried(g.id, false);
1663
1702
  if (g.started)