@n-uf/placement 26.11.41 → 26.11.43
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 +38 -0
- package/README.md +22 -4
- package/dist/{chunk-2IZ6JZV5.js → chunk-2GGJ4GVR.js} +1 -1
- package/dist/{chunk-2IZ6JZV5.js.map → chunk-2GGJ4GVR.js.map} +1 -1
- package/dist/{chunk-NRARI4Q2.js → chunk-PO3ILUMO.js} +56 -12
- package/dist/chunk-PO3ILUMO.js.map +1 -0
- package/dist/desk.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{model-C-Z5PDBp.d.ts → model-CSO5fk_L.d.ts} +10 -3
- package/dist/panels.d.ts +3 -3
- package/dist/scene-cases.d.ts +4 -4
- package/dist/scene-cases.js +4 -4
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +4 -4
- package/dist/scene.js +3 -1
- package/dist/stack.d.ts +1 -1
- package/dist/{target-Db9z1bWt.d.ts → target-BBOCeez2.d.ts} +19 -0
- package/dist/{targets-CYs16P4K.d.ts → targets-C9ZVhmCl.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-NRARI4Q2.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
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.43
|
|
7
|
+
|
|
8
|
+
- `./scene`, **`Target.roomHit`** (additive): a target that opens its room and changes an edge's thickness around the
|
|
9
|
+
content (an empty rail beside a column, a new-column line, an empty bar's strip) carries the smallest rect holding its
|
|
10
|
+
hit and its landing rect. The drag intent then holds it there once the room is open: the drawn room is its zone, so a
|
|
11
|
+
pointer that drifts inside the rail it opened keeps it. A refusal or a place no more precise under the held room
|
|
12
|
+
doesn't take over; those places are reachable once the pointer leaves the room. While a shown empty bar's room is
|
|
13
|
+
open, an equal-priority gap under it (for example a corner gap of a side bar) is reachable only after the pointer
|
|
14
|
+
leaves that room. Rail drop strips don't carry it.
|
|
15
|
+
|
|
16
|
+
- `./scene`, **an empty rail or bar is entered over its drawn depth** (behavior). Its targets' hits run as deep as a
|
|
17
|
+
drop draws it (the rail's or the bar's drawn depth) instead of a 12 px band, over columns that refuse the item too;
|
|
18
|
+
past the thin band that depth never takes the zones of a drawn edge that take the item. An empty column keeps the thin
|
|
19
|
+
band.
|
|
20
|
+
|
|
21
|
+
- `./scene`, **`EDGE_ROOM_HOLD` is 0** (behavior, was 70 ms). A rail target or a new-column line against the window's
|
|
22
|
+
left or right edge shows with its room on the frame an aiming pointer enters it, so a toolbar held at the edge no
|
|
23
|
+
longer jumps away across the column and back. Grazing the edge with a held item now opens its rail. The accepted cost:
|
|
24
|
+
over recorded sweeps along the window's edges, about 29 rail openings instead of 20, mostly from grazing the edge.
|
|
25
|
+
|
|
26
|
+
## 26.11.42
|
|
27
|
+
|
|
28
|
+
- `./scene`, docs: **a refused place is never drawn.** The docs no longer suggest a tint or outline over `refusals()`:
|
|
29
|
+
a host draws nothing there and may say "Can't go here" at the pointer while the frame's `refused` is set. The
|
|
30
|
+
refusals and `refusalTargets` are unchanged.
|
|
31
|
+
|
|
32
|
+
- `./scene`, fixed: **a target's room opens with it where its indicator would cover what moves** (additive). A target
|
|
33
|
+
whose slot overlaps an item its drop moves (an empty toolbar rail pushing the panel column, a new-column line, a bar's
|
|
34
|
+
strip over the columns) now carries `opensRoom` (`Target.opensRoom`). That includes an item of the edge the dragged
|
|
35
|
+
item leaves when the drop pushes it; one that only closes up over the dragged item's place doesn't count, and neither
|
|
36
|
+
do the items of the edge dropped on, so a gap between a column's cards stays as it was. With `@n-uf/motion/drag`'s
|
|
37
|
+
`opensRoom` the indicator and the room come in one frame, so these targets show later than they did, and never over
|
|
38
|
+
what they move. How long they wait: a rail target or a new-column line against the window's left or right edge,
|
|
39
|
+
`roomHold` = `EDGE_ROOM_HOLD` (70 ms, new); any other, `roomAfter` (160 ms); a rail drop strip's target, no further
|
|
40
|
+
wait once its dwell has armed it, and it carries `opensRoom` too. A release before the target shows still lands on it.
|
|
41
|
+
A host that draws only a marker opens the room on `frame.room && frame.shown?.opensRoom`, for all of them. The room's
|
|
42
|
+
geometry is unchanged.
|
|
43
|
+
|
|
6
44
|
## 26.11.41
|
|
7
45
|
|
|
8
46
|
- `./scene`, **`use` is idempotent** (behavior change). `use(scene, id)` on an item whose `used` is already strictly
|
package/README.md
CHANGED
|
@@ -1220,16 +1220,17 @@ facing halves is home's, and is no target of its own. The slot is where the item
|
|
|
1220
1220
|
strip's below): its tile in the rail, or a rider bar over the side's open column when lifting the item lets a column
|
|
1221
1221
|
that was folded by width reopen; the slot is that landing. With no rail showing, the stop keeps its place only while
|
|
1222
1222
|
one of its slots lands in the rail (home's counts): where every drop there is refused (a panel would ride over an
|
|
1223
|
-
open column), the outermost column line runs from the window's edge.
|
|
1224
|
-
|
|
1223
|
+
open column), the outermost column line runs from the window's edge. A refused place is never drawn: no tint, outline
|
|
1224
|
+
or zone label over it; while the pointer is over one a host may say "Can't go here" at the pointer. A refusal matches
|
|
1225
|
+
what is drawn: an edge that takes the
|
|
1225
1226
|
dragged kind in no zone is one refusal, `refuse:<edge>:start` (`n = 0`), over its drawn rect (the `SceneEdgeLayout`
|
|
1226
|
-
rect, fixed items included) less what targets own, so
|
|
1227
|
+
rect, fixed items included) less what targets own, so the message shows over the whole bar as drawn
|
|
1227
1228
|
(where a target splits it, every piece of 1 px and more is in `hits`, `hit` the largest: the pointer is in the
|
|
1228
1229
|
refusal in any piece); a
|
|
1229
1230
|
refused zone of an edge that takes the kind elsewhere keeps its slot's tile, inside the edge's ends. No refusal
|
|
1230
1231
|
reaches past the stage. Hand them to the drag intent with the targets: `refusalTargets(refusals(scene, id))` gives
|
|
1231
1232
|
each one as a target marked `refuse: true` (its `refusal` the `SceneRefusal`), which the intent never holds or
|
|
1232
|
-
shows, so a held target's band never covers a refusal;
|
|
1233
|
+
shows, so a held target's band never covers a refusal; show "Can't go here" while the frame's `refused` is set.
|
|
1233
1234
|
In the pick a refusal ranks at `REFUSAL_RANK` (2.5, exported with `pickRank`, the drag intent's value): an ordering
|
|
1234
1235
|
rank, not a priority (priorities stay 1, 2 and 3; `refuse: true` is a refusal's tier), after every target of
|
|
1235
1236
|
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
|
|
@@ -1240,6 +1241,23 @@ facing halves is home's, and is no target of its own. The slot is where the item
|
|
|
1240
1241
|
`y + height`) picks a gap or slot whose hit reaches the edge, else nothing: a drop past the window over open space or
|
|
1241
1242
|
past a refused bar commits nothing, and a held gap keeps its band. A host that clamps to `width - 0.5` still picks
|
|
1242
1243
|
inside the window, the float or a refusal there included.
|
|
1244
|
+
A target's room opens with it where its indicator would otherwise cover what moves: a target whose slot overlaps an
|
|
1245
|
+
item that its drop moves (an empty rail pushing the column beside it, a new-column line, a bar's strip over the
|
|
1246
|
+
columns) carries `opensRoom`, and the drag intent shows it and reports `room` in the same frame. An item of the edge
|
|
1247
|
+
the dragged item leaves counts when the drop pushes it, not when it only closes up over that place; the items of the
|
|
1248
|
+
edge dropped on never do, so a gap between a column's cards is a plain gap. The wait depends on the target: `roomHold`
|
|
1249
|
+
= `EDGE_ROOM_HOLD` (0 ms: it shows on the frame an aiming pointer enters it) on a rail target or a new-column line
|
|
1250
|
+
against the window's left or right edge, so a toolbar held at the edge never jumps away across the column and back
|
|
1251
|
+
(grazing the edge opens the rail); the intent's `roomAfter` (160 ms) on any other; on a rail drop strip's target, also
|
|
1252
|
+
marked, none past the dwell that arms it. A release before it shows still lands on it. A host that draws only a marker
|
|
1253
|
+
opens the room on `frame.room && frame.shown?.opensRoom`, for every one of them. An empty rail or bar is entered over
|
|
1254
|
+
the depth a drop draws it at (a rail's or a bar's drawn depth), not a thin band; past the thin band that depth never takes
|
|
1255
|
+
the zones of a drawn edge that take the item, and an empty column keeps the thin band. A target whose drop changes an
|
|
1256
|
+
edge's thickness around the content (an empty rail beside a column, a new-column line, an empty bar's strip) also
|
|
1257
|
+
carries `roomHit`, the smallest rect holding its hit and its landing rect. While it shows with its room open, the drag
|
|
1258
|
+
intent holds it there: the drawn room is its zone, so a refusal or a place no more precise under it doesn't take
|
|
1259
|
+
over, and those places are reachable once the pointer leaves the room. A rail drop strip (`armedHit`) doesn't carry
|
|
1260
|
+
it.
|
|
1243
1261
|
Every target keeps a reachable hit: its largest piece is at least 12 px across by 24 px along (`minHit`, data per
|
|
1244
1262
|
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
|
|
1245
1263
|
aimed at, or from a neighbor that keeps its own minimum. Home, a drop strip, a refusal, the chrome and the stage's
|
|
@@ -1 +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":";
|
|
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 * Its room opens as it shows: the scene sets it on a target whose slot overlaps an item its drop moves (a rail pushing\n * a column, a new-column line, a bar's strip over the columns), and on a rail drop strip's targets, whose room opens\n * once armed. The drag intent then shows it and makes its room in one frame. Until it shows, a release still lands on\n * it.\n */\n readonly opensRoom?: true;\n /**\n * With `opensRoom`, how long it holds before it shows with its room, ms, in place of the drag intent's `roomAfter`. The\n * scene sets it to `EDGE_ROOM_HOLD` on a rail target or a new-column line against the window's left or right edge.\n */\n readonly roomHold?: number;\n /**\n * With `opensRoom`, the zone it holds once its room is open: while the target shows with its room open, a drag intent\n * holds it wherever the pointer is in this rect. The scene sets it to the smallest rect holding `hit` and the slot (the\n * landing rect) on every target whose drop changes an edge's thickness (a side's width or a bar's height): strips,\n * new-column lines, rails and gaps. A rail drop strip (`armedHit`) doesn't carry it.\n */\n readonly roomHit?: 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":";AA8DO,IAAM,eAAe;AAGrB,IAAM,WAAW,CAAC,MAAsE,EAAE,WAAW,OAAO,eAAe,EAAE;","names":[]}
|
|
@@ -27,6 +27,7 @@ var RAIL_MODES = ["titles", "icons"];
|
|
|
27
27
|
var RAIL_VISIBILITIES = ["whileDragging", "always", "never"];
|
|
28
28
|
var RAIL_STRIP_MIN = 24;
|
|
29
29
|
var DEFAULT_RAIL_MAGNET = 6;
|
|
30
|
+
var EDGE_ROOM_HOLD = 0;
|
|
30
31
|
var DEFAULT_STRIP = 24;
|
|
31
32
|
var DEFAULT_HIT_BAND = 24;
|
|
32
33
|
var DEFAULT_FLOAT_SIZE = { width: 280, height: 360 };
|
|
@@ -2020,7 +2021,9 @@ function edgeSpec(c, edge) {
|
|
|
2020
2021
|
const strip = Math.max(0, Number.isFinite(edge.strip) ? edge.strip : DEFAULT_STRIP);
|
|
2021
2022
|
const outer = edge.side === "left" ? r.x : edge.side === "right" ? r.x + r.width : edge.side === "top" ? r.y : r.y + r.height;
|
|
2022
2023
|
const inward = (depth) => edge.side === "left" || edge.side === "top" ? [outer, outer + depth] : [outer - depth, outer];
|
|
2023
|
-
const
|
|
2024
|
+
const thin = edgeKind === "rail" || edgeKind === "bar" || edgeKind === "barBetween";
|
|
2025
|
+
const landed = el.cross > 0 || !thin ? 0 : Math.max(0, ...slots.map((s) => s.result.layout.edges[edge.id]?.cross ?? 0));
|
|
2026
|
+
const across2 = (after) => inward((el.cross > 0 ? Math.max(el.cross, after?.edges[edge.id]?.cross ?? 0) : Math.max(strip, landed)) + data.inward);
|
|
2024
2027
|
const drawn = el.cross > 0;
|
|
2025
2028
|
const marker = (s) => {
|
|
2026
2029
|
const slot = s.result.layout.items[dragged].rect;
|
|
@@ -2042,7 +2045,8 @@ function edgeSpec(c, edge) {
|
|
|
2042
2045
|
reserved,
|
|
2043
2046
|
cards,
|
|
2044
2047
|
across: across2,
|
|
2045
|
-
owned: inward(drawn ? el.cross : Math.min(strip, data.place)),
|
|
2048
|
+
owned: inward(drawn ? el.cross : landed > 0 ? landed : Math.min(strip, data.place)),
|
|
2049
|
+
...!drawn && landed > Math.min(strip, data.place) ? { thinOwned: inward(Math.min(strip, data.place)) } : {},
|
|
2046
2050
|
ownedAlong: null,
|
|
2047
2051
|
drawn,
|
|
2048
2052
|
marker
|
|
@@ -2138,15 +2142,15 @@ function homeRectOf(c, ownSpec) {
|
|
|
2138
2142
|
const own = c.now.items[c.dragged];
|
|
2139
2143
|
if (!own || own.floating || !own.edge) return null;
|
|
2140
2144
|
const o = own.rect;
|
|
2141
|
-
const
|
|
2145
|
+
const hull2 = (a, b) => rect(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.max(a.x + a.width, b.x + b.width) - Math.min(a.x, b.x), Math.max(a.y + a.height, b.y + b.height) - Math.min(a.y, b.y));
|
|
2142
2146
|
if (own.inMenu) return o;
|
|
2143
2147
|
if (!ownSpec) {
|
|
2144
2148
|
const e = c.now.edges[own.edge];
|
|
2145
2149
|
const vanishes = !c.rest.edges.some((x) => x.id === own.edge);
|
|
2146
|
-
return e && vanishes && !e.folded && !e.rides && area(e.rect) > EPS ?
|
|
2150
|
+
return e && vanishes && !e.folded && !e.rides && area(e.rect) > EPS ? hull2(o, e.rect) : o;
|
|
2147
2151
|
}
|
|
2148
2152
|
const [c0, c1] = ownSpec.across();
|
|
2149
|
-
return ownSpec.vertical ?
|
|
2153
|
+
return ownSpec.vertical ? hull2(o, rect(c0, o.y, c1 - c0, o.height)) : hull2(o, rect(o.x, c0, o.width, c1 - c0));
|
|
2150
2154
|
}
|
|
2151
2155
|
function ownersOf(c, live, drawn, alongOf) {
|
|
2152
2156
|
const ownEdge = c.now.items[c.dragged]?.edge;
|
|
@@ -2158,7 +2162,12 @@ function ownersOf(c, live, drawn, alongOf) {
|
|
|
2158
2162
|
// Every edge the tiler reads, along each zone with a slot the filter keeps: what it owns, drawn or a band of its
|
|
2159
2163
|
// place (a column line's band about its line). A zone whose every slot is refused owns nothing against the others
|
|
2160
2164
|
// (its drawn rect still counts, below).
|
|
2161
|
-
...live.flatMap((s) =>
|
|
2165
|
+
...live.flatMap((s) => {
|
|
2166
|
+
const rects = ownedRectsOf(s, alongOf(s));
|
|
2167
|
+
if (!s.thinOwned) return rects.map((r) => ({ spec: s, rect: r, lay: s.lay, place: !s.drawn }));
|
|
2168
|
+
const thin = (r) => s.vertical ? rect(Math.max(r.x, s.thinOwned[0]), r.y, Math.min(r.x + r.width, s.thinOwned[1]) - Math.max(r.x, s.thinOwned[0]), r.height) : rect(r.x, Math.max(r.y, s.thinOwned[0]), r.width, Math.min(r.y + r.height, s.thinOwned[1]) - Math.max(r.y, s.thinOwned[0]));
|
|
2169
|
+
return rects.flatMap((r) => [{ spec: s, rect: thin(r), lay: s.lay, place: true }, ...subtract(r, thin(r)).map((d) => ({ spec: s, rect: d, lay: s.lay, place: true, deep: true }))]);
|
|
2170
|
+
}).filter((o) => area(o.rect) > EPS),
|
|
2162
2171
|
// Every seen rect: the edges the tiler doesn't read (folded, riding, taking nothing) among them.
|
|
2163
2172
|
...drawn.map((d) => ({ ...d, place: false }))
|
|
2164
2173
|
];
|
|
@@ -2174,12 +2183,19 @@ function ownership(c, live, alongOf) {
|
|
|
2174
2183
|
const place = !s.drawn;
|
|
2175
2184
|
return o.place === place ? !place || o.lay.at < s.lay.at : !o.place;
|
|
2176
2185
|
};
|
|
2186
|
+
const takingRects = (s) => s.drawn ? s.zones.filter((z) => s.slots.some((sl) => sl.ok && sl.zone === z.zone)).map((z) => s.vertical ? rect(s.owned[0], z.a, s.owned[1] - s.owned[0], z.b - z.a) : rect(z.a, s.owned[0], z.b - z.a, s.owned[1] - s.owned[0])) : [];
|
|
2187
|
+
const thinRectOf = (s) => {
|
|
2188
|
+
const b = bandOf(s);
|
|
2189
|
+
const [t0, t1] = s.thinOwned;
|
|
2190
|
+
return s.vertical ? rect(t0, b.y, t1 - t0, b.height) : rect(b.x, t0, b.width, t1 - t0);
|
|
2191
|
+
};
|
|
2177
2192
|
const taken = new Map(
|
|
2178
2193
|
live.map((s) => [
|
|
2179
2194
|
s,
|
|
2180
2195
|
[
|
|
2181
|
-
...owners.filter((o) => wins(o, s)).
|
|
2182
|
-
...EDGE_KINDS[s.kind].virtual ? owners.filter((o) => o.spec !== s && !wins(o, s)).flatMap((o) => subtract(o.rect, ownedRectOf(s))) : []
|
|
2196
|
+
...owners.filter((o) => wins(o, s)).flatMap((o) => o.deep ? takingRects(s).reduce((acc, t) => acc.flatMap((r) => subtract(r, t)), [o.rect]) : [o.rect]),
|
|
2197
|
+
...EDGE_KINDS[s.kind].virtual ? owners.filter((o) => o.spec !== s && !wins(o, s)).flatMap((o) => subtract(o.rect, ownedRectOf(s))) : [],
|
|
2198
|
+
...s.thinOwned ? live.filter((d) => d !== s).flatMap((d) => takingRects(d).flatMap((t) => subtract(t, thinRectOf(s)))) : []
|
|
2183
2199
|
]
|
|
2184
2200
|
])
|
|
2185
2201
|
);
|
|
@@ -2780,6 +2796,8 @@ ${r.zone}`) ?? [], r]);
|
|
|
2780
2796
|
hit: rect(s.rect.x, a, s.rect.width, b - a),
|
|
2781
2797
|
armedHit: rect(grown.x, a, grown.width, b - a),
|
|
2782
2798
|
arm: "dwell",
|
|
2799
|
+
// Armed, its room opens at once: a host that draws only a marker reads that from this one flag, as for any target.
|
|
2800
|
+
opensRoom: true,
|
|
2783
2801
|
strip: s.rect,
|
|
2784
2802
|
slot,
|
|
2785
2803
|
item: c.dragged,
|
|
@@ -2956,7 +2974,7 @@ function specsOf(c, kind) {
|
|
|
2956
2974
|
return specs.filter((s) => s !== null);
|
|
2957
2975
|
}
|
|
2958
2976
|
function emit2(c, placed) {
|
|
2959
|
-
const { scene, now, dragged } = c;
|
|
2977
|
+
const { scene, now, base, dragged } = c;
|
|
2960
2978
|
const homeId = targetId({ kind: "home", item: dragged });
|
|
2961
2979
|
const targets2 = [];
|
|
2962
2980
|
const refused = [];
|
|
@@ -2994,10 +3012,34 @@ function emit2(c, placed) {
|
|
|
2994
3012
|
continue;
|
|
2995
3013
|
}
|
|
2996
3014
|
const result = t.result;
|
|
2997
|
-
|
|
3015
|
+
const atEdge = WINDOW_EDGE_KINDS.has(t.edgeKind) && touchesSide(scene.stage, t.hits ?? [t.hit]);
|
|
3016
|
+
const thickens = thicknessChanges(now, result.layout);
|
|
3017
|
+
const room = t.slot && slotOverMoved(now, base, result.layout, t.slot, dragged, t.edge) ? { opensRoom: true, ...atEdge ? { roomHold: EDGE_ROOM_HOLD } : {}, ...thickens ? { roomHit: hull(t.hit, t.slot) } : {} } : {};
|
|
3018
|
+
targets2.push({ id: t.id, priority: t.priority, hit: t.hit, ...t.hits ? { hits: t.hits } : {}, ...t.slot ? { slot: t.slot } : {}, ...t.marker ? { marker: t.marker } : {}, ...room, item: dragged, place: t.place, after: () => result });
|
|
2998
3019
|
}
|
|
2999
3020
|
return { targets: targets2, refused, ownHome };
|
|
3000
3021
|
}
|
|
3022
|
+
function hull(a, b) {
|
|
3023
|
+
const x = Math.min(a.x, b.x);
|
|
3024
|
+
const y = Math.min(a.y, b.y);
|
|
3025
|
+
return rect(x, y, Math.max(a.x + a.width, b.x + b.width) - x, Math.max(a.y + a.height, b.y + b.height) - y);
|
|
3026
|
+
}
|
|
3027
|
+
var thicknessChanges = (now, after) => {
|
|
3028
|
+
const a = now.content;
|
|
3029
|
+
const b = after.content;
|
|
3030
|
+
return Math.abs(b.x - a.x) > EPS || Math.abs(b.y - a.y) > EPS || Math.abs(b.x + b.width - (a.x + a.width)) > EPS || Math.abs(b.y + b.height - (a.y + a.height)) > EPS;
|
|
3031
|
+
};
|
|
3032
|
+
var WINDOW_EDGE_KINDS = /* @__PURE__ */ new Set(["rail", "railStop", "sideBar", "columnLine"]);
|
|
3033
|
+
var touchesSide = (stage, pieces) => pieces.some((r) => r.x <= stage.x + EPS || r.x + r.width >= stage.x + stage.width - EPS);
|
|
3034
|
+
function slotOverMoved(now, lifted, after, slot, dragged, onto) {
|
|
3035
|
+
const from = now.items[dragged]?.edge;
|
|
3036
|
+
return Object.entries(now.items).some(([id, was]) => {
|
|
3037
|
+
if (!overlaps(slot, was.rect) || id === dragged || was.floating || was.edge === onto) return false;
|
|
3038
|
+
const r = after.items[id]?.rect;
|
|
3039
|
+
const start = (from !== void 0 && was.edge === from ? lifted.items[id]?.rect : void 0) ?? was.rect;
|
|
3040
|
+
return !!r && (Math.abs(r.x - start.x) > EPS || Math.abs(r.y - start.y) > EPS || Math.abs(r.width - start.width) > EPS || Math.abs(r.height - start.height) > EPS);
|
|
3041
|
+
});
|
|
3042
|
+
}
|
|
3001
3043
|
function alongOfSlots(s, tiles) {
|
|
3002
3044
|
const spans = tiles.filter((t) => t.kind === "slot").map((t) => s.vertical ? [t.hit.y, t.hit.y + t.hit.height] : [t.hit.x, t.hit.x + t.hit.width]).sort((a, b) => a[0] - b[0]);
|
|
3003
3045
|
const out = [];
|
|
@@ -3099,7 +3141,8 @@ function generateShown(scene, dragged, options, hidden) {
|
|
|
3099
3141
|
const zones = /* @__PURE__ */ new Map();
|
|
3100
3142
|
for (const t of [...alone.values()].flat()) if (t.kind !== "refuse" && t.id) zones.set(t.id, [...zones.get(t.id) ?? [], t.hit]);
|
|
3101
3143
|
const bounds = stageOf(scene);
|
|
3102
|
-
|
|
3144
|
+
const held = withMinHit(c, layered.targets, layered.refusals, zones).map((t) => t.roomHit && t.slot ? { ...t, roomHit: hull(t.hit, t.slot) } : t);
|
|
3145
|
+
return { targets: held, refusals: layered.refusals.map((r) => ({ ...r, bounds })), lost: lostIds, zones };
|
|
3103
3146
|
}
|
|
3104
3147
|
var stageOf = (scene) => rect(scene.stage.x, scene.stage.y, scene.stage.width, scene.stage.height);
|
|
3105
3148
|
function targets(scene, dragged, options = {}) {
|
|
@@ -3163,6 +3206,7 @@ export {
|
|
|
3163
3206
|
RAIL_VISIBILITIES,
|
|
3164
3207
|
RAIL_STRIP_MIN,
|
|
3165
3208
|
DEFAULT_RAIL_MAGNET,
|
|
3209
|
+
EDGE_ROOM_HOLD,
|
|
3166
3210
|
DEFAULT_STRIP,
|
|
3167
3211
|
DEFAULT_HIT_BAND,
|
|
3168
3212
|
DEFAULT_FLOAT_SIZE,
|
|
@@ -3207,4 +3251,4 @@ export {
|
|
|
3207
3251
|
refusalTargets,
|
|
3208
3252
|
stops
|
|
3209
3253
|
};
|
|
3210
|
-
//# sourceMappingURL=chunk-
|
|
3254
|
+
//# sourceMappingURL=chunk-PO3ILUMO.js.map
|