@grafloria/element 0.4.55 → 0.4.57

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.
@@ -88,6 +88,16 @@ export interface ResolveInput {
88
88
  * be put beside the container it is still inside.
89
89
  */
90
90
  homeChain: ReadonlySet<string>;
91
+ /**
92
+ * Containers of the source board as they stood when the gesture began (a
93
+ * GROUP ghost pushes solids with intent, 0.4.44). The hand over a pushed
94
+ * container's rest frame still means that container — its zones, its
95
+ * page tested at the displacement — or a group could never enter a
96
+ * container its own body reaches before the hand does: the target fled.
97
+ * The engine's memory brings the pushed container home when the ghost
98
+ * leaves the board.
99
+ */
100
+ restFrames?: ReadonlyMap<string, ZoneRect>;
91
101
  }
92
102
  export type Zone = {
93
103
  kind: 'off';
@@ -95,7 +95,12 @@ export function resolve(input) {
95
95
  return { kind: 'beside', board, containerId: p.containerId, side: p.side, kept: true };
96
96
  }
97
97
  }
98
- const opaque = (board, c) => c.static || input.ghostSubtree.has(c.id) || board.depth + 1 + input.ghostDepth > input.maxDepth;
98
+ // A static container and a container too deep for the ghost are obstacles:
99
+ // the hand over them means a cell on their parent board. The GHOST'S OWN
100
+ // subtree is not an obstacle but glass: a container carried by hand has its
101
+ // frame under the pointer at every step, and reading it as a hit answered
102
+ // "plain on the parent" before the walk ever looked at the page beneath.
103
+ const opaque = (board, c) => c.static || board.depth + 1 + input.ghostDepth > input.maxDepth;
99
104
  // The container the hand holds is read at REST: its live frame is where the
100
105
  // beside pushed or shifted it, and a hand crossing from its top band to its
101
106
  // corner would otherwise find it gone from under the pointer (0.4.48's
@@ -103,11 +108,16 @@ export function resolve(input) {
103
108
  // same displacement.
104
109
  const held = input.prev;
105
110
  const descend = (board, dx, dy) => {
111
+ var _a;
106
112
  const px = x + dx;
107
113
  const py = y + dy;
108
114
  for (const c of board.children()) {
109
- // the held container at rest — unless the hand has left that frame for the live one
110
- const atRest = held && c.id === held.containerId && inRect(held.frame0, x, y) ? held.frame0 : null;
115
+ if (input.ghostSubtree.has(c.id))
116
+ continue; // the carried container itself, and the boards inside it: glass
117
+ // the held container at rest — unless the hand has left that frame for the live one;
118
+ // and any container the ghost pushed, at rest the same way
119
+ const rest = (_a = input.restFrames) === null || _a === void 0 ? void 0 : _a.get(c.id);
120
+ const atRest = rest && inRect(rest, x, y) ? rest : held && c.id === held.containerId && inRect(held.frame0, x, y) ? held.frame0 : null;
111
121
  const frame = atRest !== null && atRest !== void 0 ? atRest : c.frame;
112
122
  const tx = atRest ? x : px;
113
123
  const ty = atRest ? y : py;