@n-uf/placement 26.11.37 → 26.11.38
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/CHANGELOG.md +29 -0
- package/README.md +26 -0
- package/dist/chunk-2IZ6JZV5.js +9 -0
- package/dist/chunk-2IZ6JZV5.js.map +1 -0
- package/dist/{chunk-2PWDUBPG.js → chunk-GWZ5BPIN.js} +83 -21
- package/dist/chunk-GWZ5BPIN.js.map +1 -0
- package/dist/desk.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/{model-CuE-ML-f.d.ts → model-bUSbHw8v.d.ts} +27 -3
- package/dist/panels.d.ts +3 -3
- package/dist/scene-cases.d.ts +17 -9
- package/dist/scene-cases.js +39 -6
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +8 -4
- package/dist/scene.js +1 -1
- package/dist/stack.d.ts +1 -1
- package/dist/target-Db9z1bWt.d.ts +50 -0
- package/dist/{targets-DnVNZVQW.d.ts → targets-CYs16P4K.d.ts} +1 -1
- package/dist/targets.d.ts +2 -2
- package/dist/tiling.d.ts +1 -1
- package/package.json +2 -2
- package/dist/chunk-2PWDUBPG.js.map +0 -1
- package/dist/target-fhD5UVlt.d.ts +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
3
3
|
Versions are calendar versions, `YY.M.R` (year, month of the release, counter within the month), shared with
|
|
4
4
|
`@n-uf/motion`: both packages carry the same version, and a release bumps both.
|
|
5
5
|
|
|
6
|
+
## 26.11.38
|
|
7
|
+
|
|
8
|
+
- `./scene`, **`Edge.showIn`** (additive): a hidden edge that names another, static edge lends it its items, which lay
|
|
9
|
+
out, target and stop as if they sat at the end of that edge, while the stored scene keeps them in the hidden edge. Home
|
|
10
|
+
gives back the scene itself; a real move takes the item out of the hidden edge; shown again, the hidden edge holds
|
|
11
|
+
every item no drop moved. Only items whose kind that edge takes are lent (in the first zone that takes them, where
|
|
12
|
+
their own doesn't). Never stored (`readScene` lists a stored one as `edge:<id>:showIn`); a `showIn` naming the edge
|
|
13
|
+
itself, no edge, another hidden edge or a dynamic column (drops make and delete those) is ignored and noted as
|
|
14
|
+
`show-in-ignored`: `SceneNote` gains that code, so an exhaustive `switch` over `code` needs a case for it. A moved
|
|
15
|
+
item keeps its stored zone unless the drop names one. `canFold` and `fold` read a lent item where it is drawn. Scenes
|
|
16
|
+
without it are unchanged.
|
|
17
|
+
|
|
18
|
+
- `./scene`, **the window's edge belongs only to the targets drawn against it** (pick change). Every refusal now
|
|
19
|
+
carries the stage as `bounds` (`SceneRefusal.bounds`, passed on by `refusalTargets`), and so does the float target
|
|
20
|
+
(`Target.bounds`): with `@n-uf/motion/drag` 26.11.38 they hold only points strictly inside the window. A pointer a
|
|
21
|
+
host clamps exactly onto the window's edge (`x + width`; one clamped to `width - 0.5` still picks inside) picks a gap
|
|
22
|
+
or slot whose hit reaches the edge (P7-end-reach still lands in the last gap), else nothing: a drop past the window over open space, or past a refused bar, commits nothing, where it floated
|
|
23
|
+
before. Conformance row C17's expected answer changed (the float dropped past the stage's right edge stays where it
|
|
24
|
+
was), and new row `P7-past-a-refused-bar`; a host on an older library fails them until it upgrades. The reference
|
|
25
|
+
host's `pickTarget` and `PickCandidate.bounds` follow.
|
|
26
|
+
|
|
27
|
+
- `./scene`, **a target always beats a refusal where they meet** (pick change). A refusal ranks at the new
|
|
28
|
+
`REFUSAL_RANK` (2.5, from the package root with `pickRank`), whatever its `priority`: an ordering rank, not a
|
|
29
|
+
priority (priorities stay the integers 1 to 3; `refuse: true` is the tier), after every target of priority 1 and 2,
|
|
30
|
+
before priority 3. A test holds it equal to the drag intent's `REFUSAL_RANK`. `@n-uf/motion/drag`'s `targetAt` (26.11.38) applies it; the reference host's
|
|
31
|
+
`pickTarget` and `PickCandidate.refuse` follow. A refusal that shared an edge with a larger target took that edge (a
|
|
32
|
+
gap's last row of px on a refused bar, the outer new-column line where it ends on a status line); now the target
|
|
33
|
+
does. New conformance row `P7-target-meets-a-refusal`. A host on an older drag intent fails it until it upgrades.
|
|
34
|
+
|
|
6
35
|
## 26.11.37
|
|
7
36
|
|
|
8
37
|
- `./scene`, **`Edge.hidden`** (additive): an edge kept in the scene with its items but not in the window, such as a
|
package/README.md
CHANGED
|
@@ -823,6 +823,22 @@ a blocked rect) gives back the scene itself. `moveTo` into it is refused, as int
|
|
|
823
823
|
where a drop makes or removes a column on its side, the side is numbered again from 0 with the hidden edge back where its
|
|
824
824
|
ring put it in the order. Side columns, rails and bars alike.
|
|
825
825
|
|
|
826
|
+
**Showing a hidden edge's items elsewhere.** A hidden edge with `Edge.showIn` (the id of another, static edge) lends
|
|
827
|
+
its items to that edge: a rail turned off on a narrow window whose panels show in the column beside it, say. Like `hidden`, it
|
|
828
|
+
comes from `base` and is never stored. The lent items lay out, target and stop as if they sat at the end of that edge,
|
|
829
|
+
after its own items: `solve` draws them there (the hidden edge itself stays out of the layout), and a drag of one gets
|
|
830
|
+
exactly the targets, refusals, stops and release layouts it would get there. The stored scene keeps them in the hidden
|
|
831
|
+
edge: the home target, or one that commits nothing, gives back the scene itself; a drop that moves one for real takes
|
|
832
|
+
it out of the hidden edge, to the drop's place; a drop of another item never moves them out. Shown again
|
|
833
|
+
(`hidden: false`), the hidden edge holds every item no drop moved. An item is lent only where that edge takes its kind
|
|
834
|
+
(`edgeTakes`), in its own zone where the edge takes it there, else in the first zone that does; fixed items are never
|
|
835
|
+
lent, and one that isn't stays as in a hidden edge (drawn nowhere, no targets). A moved item keeps its stored zone
|
|
836
|
+
(`align`), not the one it was shown in, unless the drop names a zone (a gap in an edge). `canFold`, `fold` and the
|
|
837
|
+
hand fold read a lent item along the edge it is drawn in. A `showIn` that names the edge itself, no edge, another
|
|
838
|
+
hidden edge or a dynamic column (`column: true`) is ignored, and `solve` lists it in `notes` as `show-in-ignored`:
|
|
839
|
+
drops make and delete dynamic columns, so they never hold lent items, and a lent item never vanishes because another
|
|
840
|
+
drop emptied the column it showed in.
|
|
841
|
+
|
|
826
842
|
**Each edge is a stack.** Left and right edges are columns (`forms.column`), top and bottom ones bars (`forms.row`),
|
|
827
843
|
each solved by `fitStack` along the length it gets, with `gap`, `pad` and `menu` passed through, its cross limits never
|
|
828
844
|
wider than the room the cut leaves. Group forms in a column take their own width (`ownCross`); open panels and headers
|
|
@@ -1186,6 +1202,16 @@ facing halves is home's, and is no target of its own. The slot is where the item
|
|
|
1186
1202
|
reaches past the stage. Hand them to the drag intent with the targets: `refusalTargets(refusals(scene, id))` gives
|
|
1187
1203
|
each one as a target marked `refuse: true` (its `refusal` the `SceneRefusal`), which the intent never holds or
|
|
1188
1204
|
shows, so a held target's band never covers a refusal; read "No room here" from the frame's `refused`.
|
|
1205
|
+
In the pick a refusal ranks at `REFUSAL_RANK` (2.5, exported with `pickRank`, the drag intent's value): an ordering
|
|
1206
|
+
rank, not a priority (priorities stay 1, 2 and 3; `refuse: true` is a refusal's tier), after every target of
|
|
1207
|
+
priority 1 and 2, before the float's 3. Where a refusal and a target meet or overlap (a gap's end on a refused bar's edge), the
|
|
1208
|
+
target wins however small the refusal is; over the refusal alone it wins over the float.
|
|
1209
|
+
The window's edge belongs only to the targets drawn against it: every refusal (`SceneRefusal.bounds`, passed on by
|
|
1210
|
+
`refusalTargets`) and the float target carry the stage as `bounds` (`Target.bounds`), so they hold only points
|
|
1211
|
+
strictly inside the window. A pointer a host clamps exactly onto the window's edge (the host contract: `x + width`,
|
|
1212
|
+
`y + height`) picks a gap or slot whose hit reaches the edge, else nothing: a drop past the window over open space or
|
|
1213
|
+
past a refused bar commits nothing, and a held gap keeps its band. A host that clamps to `width - 0.5` still picks
|
|
1214
|
+
inside the window, the float or a refusal there included.
|
|
1189
1215
|
Every target keeps a reachable hit: its largest piece is at least 12 px across by 24 px along (`minHit`, data per
|
|
1190
1216
|
edge kind), taken from the space beside it in its own zone (a column line's band, a gap's tile) where nothing else is
|
|
1191
1217
|
aimed at, or from a neighbor that keeps its own minimum. Home, a drop strip, a refusal, the chrome and the stage's
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/target.ts"],"sourcesContent":["import type { Rect } from \"./geometry\";\n\n/**\n * A drop target in the shape @n-uf/motion/drag takes: an id, a priority (1 most precise: a rail or a tab strip;\n * 2 a slot; 3 a broad area such as floating anywhere), the zone the pointer hits, and optionally where the item\n * lands, a label and whether it lands freely (no room is made for it). `hits`, when given, is the whole zone as several\n * rects (a zone that isn't one rect), `hit` the largest of them: the pointer is in the zone when it is in any of them.\n * `arm: \"dwell\"` marks a spring-loaded target (the drag intent arms it once the pointer dwells in it), `armedHit` its\n * zone once armed.\n */\nexport interface Target {\n readonly id: string;\n readonly priority: 1 | 2 | 3;\n readonly hit: Rect;\n readonly hits?: readonly Rect[];\n /** Spring-loaded: no target until the pointer dwells in it. */\n readonly arm?: \"dwell\";\n /** Its zone once armed (the strip grown by its magnet). */\n readonly armedHit?: Rect;\n readonly slot?: Rect;\n readonly label?: string;\n readonly free?: boolean;\n /**\n * A refusal, not a target: it takes part in the pick under the pointer, ranked after every target of priority 1 and 2\n * and before priority 3 (`REFUSAL_RANK`, whatever its `priority`), but nothing lands on it (`refusalTargets`).\n */\n readonly refuse?: true;\n /**\n * The drawn space the zone belongs to (the window's stage): the zone, and a drag intent's band and gap grace about\n * it, hold only points strictly inside it. The window's boundary belongs only to the targets drawn against it: the\n * scene gives `bounds` to every refusal and to the float (whole-plane), never to a gap or a slot, so a pointer clamped\n * onto the window's edge picks a gap that reaches it, else nothing. That relies on the host clamping exactly onto the\n * stage's edge (`x + width`, `y + height`): a host that clamps to `width - 0.5` still picks inside the window.\n */\n readonly bounds?: Rect;\n}\n\n/**\n * Where a refusal ranks in the pick (the drag intent's `REFUSAL_RANK`, the same value): an ordering rank, not a\n * priority. Priorities stay the integers 1, 2 and 3; a refusal's tier is `refuse: true`, ordered by this rank on the\n * same scale: after every target of priority 1 and 2, so a real target wins wherever the two meet or overlap, and\n * before priority 3 (the float).\n */\nexport const REFUSAL_RANK = 2.5;\n\n/** A target's rank in the pick: its `priority`, a refusal's {@link REFUSAL_RANK}. Lower wins. */\nexport const pickRank = (t: { readonly priority: number; readonly refuse?: true }): number => (t.refuse === true ? REFUSAL_RANK : t.priority);\n"],"mappings":";AA2CO,IAAM,eAAe;AAGrB,IAAM,WAAW,CAAC,MAAsE,EAAE,WAAW,OAAO,eAAe,EAAE;","names":[]}
|
|
@@ -59,23 +59,67 @@ function railColumnOf(scene, side, kind) {
|
|
|
59
59
|
if (scene.rails?.[side]) return void 0;
|
|
60
60
|
return scene.edges.filter((e) => e.side === side && !e.compact && e.hidden !== true && zoneTakes(e, "start", kind)).reduce((m, e) => !m || e.ring < m.ring ? e : m, void 0);
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
var showInOf = (scene, e) => {
|
|
63
|
+
if (e.hidden !== true || e.showIn === void 0) return void 0;
|
|
64
|
+
const to = scene.edges.find((x) => x.id === e.showIn);
|
|
65
|
+
return to && to !== e && to.hidden !== true && to.column !== true ? to : void 0;
|
|
66
|
+
};
|
|
67
|
+
function viewOf(scene) {
|
|
68
|
+
if (!scene.edges.some((e) => e.hidden === true)) return { view: scene, lent: /* @__PURE__ */ new Map(), ignored: [] };
|
|
69
|
+
const lent = /* @__PURE__ */ new Map();
|
|
70
|
+
const ignored = [];
|
|
71
|
+
const added = /* @__PURE__ */ new Map();
|
|
72
|
+
const items = { ...scene.items };
|
|
73
|
+
for (const e of scene.edges) {
|
|
74
|
+
if (e.hidden !== true || e.showIn === void 0) continue;
|
|
75
|
+
const to = showInOf(scene, e);
|
|
76
|
+
if (!to) {
|
|
77
|
+
ignored.push(e.id);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
for (const id of e.items) {
|
|
81
|
+
const item = Object.hasOwn(scene.items, id) ? scene.items[id] : void 0;
|
|
82
|
+
if (!item || item.fixed || lent.has(id) || to.items.includes(id) || !edgeTakes(to, item.kind)) continue;
|
|
83
|
+
lent.set(id, e.id);
|
|
84
|
+
added.set(to.id, [...added.get(to.id) ?? [], id]);
|
|
85
|
+
if (!zoneTakes(to, zoneOf(item), item.kind)) {
|
|
86
|
+
const zone = zonesTaking(to, item.kind)[0];
|
|
87
|
+
const { align: _a, ...plain } = item;
|
|
88
|
+
items[id] = zone === "start" ? plain : { ...plain, align: zone };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const edges = scene.edges.filter((e) => e.hidden !== true).map((e) => added.has(e.id) ? { ...e, items: [...e.items, ...added.get(e.id)] } : e);
|
|
93
|
+
return { view: { ...scene, edges, ...lent.size > 0 ? { items } : {} }, lent, ignored };
|
|
64
94
|
}
|
|
65
95
|
var inHiddenEdge = (scene, id) => scene.edges.some((e) => e.hidden === true && e.items.includes(id));
|
|
66
|
-
function withHiddenOf(scene, shown) {
|
|
96
|
+
function withHiddenOf(scene, shown, lent = /* @__PURE__ */ new Map(), moved, zoned = false) {
|
|
67
97
|
if (shown === scene || !scene.edges.some((e) => e.hidden === true)) return shown;
|
|
68
|
-
const
|
|
98
|
+
const back = [...lent.keys()].filter((id) => id !== moved);
|
|
99
|
+
const edges = shown.edges.filter((e) => e.hidden !== true).map((e) => back.some((id) => e.items.includes(id)) ? { ...e, items: e.items.filter((id) => !back.includes(id)) } : e);
|
|
69
100
|
scene.edges.forEach((e, i) => {
|
|
70
|
-
if (e.hidden
|
|
101
|
+
if (e.hidden !== true) return;
|
|
102
|
+
const own = moved !== void 0 && lent.get(moved) === e.id ? { ...e, items: e.items.filter((id) => id !== moved) } : e;
|
|
103
|
+
edges.splice(Math.min(i, edges.length), 0, own);
|
|
71
104
|
});
|
|
105
|
+
const items = back.length > 0 ? { ...shown.items, ...Object.fromEntries(back.map((id) => [id, scene.items[id]])) } : { ...shown.items };
|
|
106
|
+
if (moved !== void 0 && lent.has(moved) && !zoned) {
|
|
107
|
+
const was = scene.items[moved];
|
|
108
|
+
const now = items[moved];
|
|
109
|
+
const edge = edges.find((e) => e.hidden !== true && e.items.includes(moved));
|
|
110
|
+
const zone = !edge || zoneTakes(edge, zoneOf(was), was.kind) ? zoneOf(was) : zoneOf(now);
|
|
111
|
+
if (zone !== zoneOf(now) || !edge && now.align !== was.align) {
|
|
112
|
+
const { align: _a, ...plain } = now;
|
|
113
|
+
items[moved] = !edge ? was.align === void 0 ? plain : { ...plain, align: was.align } : zone === "start" ? plain : { ...plain, align: zone };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
72
116
|
const ringBefore = new Map(scene.edges.filter((e) => e.hidden !== true).map((e) => [e.id, e.ring]));
|
|
73
117
|
for (const side of new Set(scene.edges.filter((e) => e.hidden === true).map((e) => e.side))) {
|
|
74
118
|
const was = scene.edges.filter((e) => e.side === side && e.hidden !== true).map((e) => e.id).sort();
|
|
75
119
|
const now = edges.filter((e) => e.side === side && e.hidden !== true);
|
|
76
120
|
if (now.length === was.length && now.every((e) => was.includes(e.id))) continue;
|
|
77
121
|
const order = [...now].sort((a, b) => a.ring - b.ring || edges.indexOf(a) - edges.indexOf(b));
|
|
78
|
-
for (const h of
|
|
122
|
+
for (const h of edges.filter((e) => e.side === side && e.hidden === true).sort((a, b) => a.ring - b.ring)) {
|
|
79
123
|
const k = order.findIndex((e) => e.hidden !== true && (ringBefore.get(e.id) ?? -Infinity) > h.ring);
|
|
80
124
|
order.splice(k < 0 ? order.length : k, 0, h);
|
|
81
125
|
}
|
|
@@ -83,7 +127,7 @@ function withHiddenOf(scene, shown) {
|
|
|
83
127
|
if (e.ring !== ring) edges[edges.indexOf(e)] = { ...e, ring };
|
|
84
128
|
});
|
|
85
129
|
}
|
|
86
|
-
return { ...shown, edges };
|
|
130
|
+
return { ...shown, edges, items };
|
|
87
131
|
}
|
|
88
132
|
function railPolicyOf(scene, kind) {
|
|
89
133
|
const p = Object.hasOwn(scene.railDrop ?? {}, kind) ? scene.railDrop[kind] : void 0;
|
|
@@ -143,15 +187,22 @@ function startOf(item, forms, edge) {
|
|
|
143
187
|
const folded = foldedIndex(item, forms, edge);
|
|
144
188
|
return folded < 0 ? 0 : Math.min(Math.max(folded, Math.floor(item.from)), forms.length - 1);
|
|
145
189
|
}
|
|
146
|
-
function
|
|
190
|
+
function placingOf(scene, id) {
|
|
191
|
+
if (!scene.edges.some((e) => e.hidden === true && e.showIn !== void 0 && e.items.includes(id))) return scene;
|
|
192
|
+
const { view, lent } = viewOf(scene);
|
|
193
|
+
return lent.has(id) ? view : scene;
|
|
194
|
+
}
|
|
195
|
+
function axesOf(given, id) {
|
|
196
|
+
const scene = placingOf(given, id);
|
|
147
197
|
const item = scene.items[id];
|
|
148
198
|
const edge = scene.edges.find((e) => e.items.includes(id));
|
|
149
199
|
if (edge) return [axisOf(edge.side)];
|
|
150
200
|
const float = scene.floats.find((f) => f.id === id);
|
|
151
201
|
return float && item ? [float.orient ?? floatOrientOf(item)] : ["row", "column"];
|
|
152
202
|
}
|
|
153
|
-
function isHandFolded(
|
|
154
|
-
const
|
|
203
|
+
function isHandFolded(given, id) {
|
|
204
|
+
const scene = placingOf(given, id);
|
|
205
|
+
const item = Object.hasOwn(given.items, id) ? given.items[id] : void 0;
|
|
155
206
|
const edge = scene.edges.find((e) => e.items.includes(id));
|
|
156
207
|
return !!item && axesOf(scene, id).some((a) => startOf(item, formsOf(item, a), edge) > 0);
|
|
157
208
|
}
|
|
@@ -1089,11 +1140,12 @@ function laySide(d, side, cols, g, area2, f, walk, upInset, tall) {
|
|
|
1089
1140
|
// src/scene/solve.ts
|
|
1090
1141
|
function solve(given, options = {}) {
|
|
1091
1142
|
checkEdgeIds(given);
|
|
1092
|
-
const shown =
|
|
1143
|
+
const { view: shown, ignored } = viewOf(given);
|
|
1093
1144
|
const lay = (caps, gave = []) => layOut(shown, options, caps, gave);
|
|
1094
1145
|
const first = lay(/* @__PURE__ */ new Map());
|
|
1095
1146
|
const way = barGiveWay(shown, first, lay);
|
|
1096
|
-
|
|
1147
|
+
const l = way ? lay(way.caps, way.notes) : first;
|
|
1148
|
+
return ignored.length === 0 ? l : { ...l, notes: [...l.notes, ...ignored.map((edge) => ({ code: "show-in-ignored", edge }))] };
|
|
1097
1149
|
}
|
|
1098
1150
|
var withHeightOf = (area2, over) => rect(over.x, area2.y, over.width, area2.height);
|
|
1099
1151
|
function layOut(given, options, caps, gave) {
|
|
@@ -1373,7 +1425,7 @@ function floatAt(scene, id, at, orient2) {
|
|
|
1373
1425
|
function canFold(scene, id) {
|
|
1374
1426
|
const item = itemOf(scene, id);
|
|
1375
1427
|
if (!item || item.fixed && !scene.edges.some((e) => e.foldable === true && e.items.includes(id))) return false;
|
|
1376
|
-
const edge = scene.edges.find((e) => e.items.includes(id));
|
|
1428
|
+
const edge = placingOf(scene, id).edges.find((e) => e.items.includes(id));
|
|
1377
1429
|
return axesOf(scene, id).some((a) => foldedIndex(item, formsOf(item, a), edge) >= 0);
|
|
1378
1430
|
}
|
|
1379
1431
|
function fold(scene, id, on) {
|
|
@@ -1642,6 +1694,7 @@ function read(data, base) {
|
|
|
1642
1694
|
}
|
|
1643
1695
|
if (edge.column === true && isNum(e.ring)) rings.set(edge.id, e.ring);
|
|
1644
1696
|
if (e.hidden !== void 0) drop(`edge:${edge.id}:hidden`);
|
|
1697
|
+
if (e.showIn !== void 0) drop(`edge:${edge.id}:showIn`);
|
|
1645
1698
|
if (e.side !== void 0 && !SIDES.includes(e.side)) drop(`edge:${e.id}:side`);
|
|
1646
1699
|
else if (!describesAnchor && edge.column !== true && typeof e.side === "string" && e.side !== edge.side && axisOf(e.side) === axisOf(edge.side)) moves.set(edge.id, e.side);
|
|
1647
1700
|
const ids = [];
|
|
@@ -2909,23 +2962,28 @@ function alongOfSlots(s, tiles) {
|
|
|
2909
2962
|
}
|
|
2910
2963
|
function generate(scene, dragged, options) {
|
|
2911
2964
|
checkEdgeIds(scene);
|
|
2912
|
-
const shown =
|
|
2965
|
+
const { view: shown, lent } = viewOf(scene);
|
|
2913
2966
|
if (shown === scene) return generateShown(scene, dragged, options, []);
|
|
2914
|
-
if (inHiddenEdge(scene, dragged)) return { targets: [], refusals: [], lost: [] };
|
|
2967
|
+
if (inHiddenEdge(scene, dragged) && !lent.has(dragged)) return { targets: [], refusals: [], lost: [] };
|
|
2915
2968
|
const hidden = scene.edges.filter((e) => e.hidden === true);
|
|
2916
2969
|
const g = generateShown(shown, dragged, options, hidden);
|
|
2917
2970
|
const prev = { ...options.previous ? { previous: options.previous } : {}, ...options.fresh ? { fresh: options.fresh } : {} };
|
|
2971
|
+
const showsIn = hidden.some((e) => e.showIn !== void 0);
|
|
2918
2972
|
return {
|
|
2919
2973
|
...g,
|
|
2920
2974
|
targets: g.targets.map((t) => ({
|
|
2921
2975
|
...t,
|
|
2922
2976
|
after: (point, grab) => {
|
|
2923
2977
|
const a = t.after(point, grab);
|
|
2924
|
-
if (a.scene === shown) return { scene, layout: a.layout };
|
|
2925
|
-
const
|
|
2978
|
+
if (a.scene === shown) return { scene, layout: showsIn ? solve(scene, prev) : a.layout };
|
|
2979
|
+
const moved = lent.has(dragged) ? dragged : void 0;
|
|
2980
|
+
const zoned = t.place.kind === "gap" || t.place.kind === "rail" && !!railColumnOf(shown, t.place.side, scene.items[dragged].kind);
|
|
2981
|
+
const back = withHiddenOf(scene, a.scene, lent, moved, zoned);
|
|
2982
|
+
const restored = showsIn ? prune(back) : back;
|
|
2926
2983
|
const ringOf = new Map(a.scene.edges.map((e) => [e.id, e.ring]));
|
|
2927
2984
|
const renumbered = restored.edges.some((e) => e.hidden !== true && ringOf.get(e.id) !== e.ring);
|
|
2928
|
-
|
|
2985
|
+
const layout = renumbered || showsIn ? solve(restored, prev) : a.layout;
|
|
2986
|
+
return { scene: restored, layout };
|
|
2929
2987
|
}
|
|
2930
2988
|
}))
|
|
2931
2989
|
};
|
|
@@ -2959,6 +3017,8 @@ function generateShown(scene, dragged, options, hidden) {
|
|
|
2959
3017
|
priority: 3,
|
|
2960
3018
|
free: true,
|
|
2961
3019
|
hit: PLANE,
|
|
3020
|
+
// Over the whole plane, but only strictly inside the stage: its edge belongs to the targets drawn against it.
|
|
3021
|
+
bounds: stageOf(scene),
|
|
2962
3022
|
item: dragged,
|
|
2963
3023
|
place: { kind: "float" },
|
|
2964
3024
|
after(point, grab) {
|
|
@@ -2990,8 +3050,10 @@ function generateShown(scene, dragged, options, hidden) {
|
|
|
2990
3050
|
const layered = withRailStrips(c, targets2, refused);
|
|
2991
3051
|
const zones = /* @__PURE__ */ new Map();
|
|
2992
3052
|
for (const t of [...alone.values()].flat()) if (t.kind !== "refuse" && t.id) zones.set(t.id, [...zones.get(t.id) ?? [], t.hit]);
|
|
2993
|
-
|
|
3053
|
+
const bounds = stageOf(scene);
|
|
3054
|
+
return { targets: withMinHit(c, layered.targets, layered.refusals, zones), refusals: layered.refusals.map((r) => ({ ...r, bounds })), lost: lostIds, zones };
|
|
2994
3055
|
}
|
|
3056
|
+
var stageOf = (scene) => rect(scene.stage.x, scene.stage.y, scene.stage.width, scene.stage.height);
|
|
2995
3057
|
function targets(scene, dragged, options = {}) {
|
|
2996
3058
|
return generate(scene, dragged, options).targets;
|
|
2997
3059
|
}
|
|
@@ -2999,7 +3061,7 @@ function refusals(scene, dragged, options = {}) {
|
|
|
2999
3061
|
return generate(scene, dragged, options).refusals;
|
|
3000
3062
|
}
|
|
3001
3063
|
function refusalTargets(list) {
|
|
3002
|
-
return list.map((r) => ({ id: r.id, priority: 2, hit: r.hit, ...r.hits ? { hits: r.hits } : {}, refuse: true, refusal: r }));
|
|
3064
|
+
return list.map((r) => ({ id: r.id, priority: 2, hit: r.hit, ...r.hits ? { hits: r.hits } : {}, ...r.bounds ? { bounds: r.bounds } : {}, refuse: true, refusal: r }));
|
|
3003
3065
|
}
|
|
3004
3066
|
var SIDE_RANK = { left: 0, top: 1, bottom: 2, right: 3 };
|
|
3005
3067
|
function stops(scene, dragged, options = {}) {
|
|
@@ -3095,4 +3157,4 @@ export {
|
|
|
3095
3157
|
refusalTargets,
|
|
3096
3158
|
stops
|
|
3097
3159
|
};
|
|
3098
|
-
//# sourceMappingURL=chunk-
|
|
3160
|
+
//# sourceMappingURL=chunk-GWZ5BPIN.js.map
|