@n-uf/placement 26.11.42 → 26.11.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/CHANGELOG.md +36 -0
- package/README.md +23 -4
- package/dist/{chunk-IRPPHM2J.js → chunk-2GGJ4GVR.js} +1 -1
- package/dist/{chunk-IRPPHM2J.js.map → chunk-2GGJ4GVR.js.map} +1 -1
- package/dist/{chunk-QL2IRBIH.js → chunk-32BGJAJA.js} +48 -15
- package/dist/chunk-32BGJAJA.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-BrvKHo50.d.ts → model-BONZVBjm.d.ts} +20 -4
- package/dist/panels.d.ts +3 -3
- package/dist/scene-cases.d.ts +2 -2
- package/dist/scene-cases.js +2 -2
- package/dist/scene.d.ts +3 -3
- package/dist/scene.js +1 -1
- package/dist/stack.d.ts +1 -1
- package/dist/{target-BLAoaUI7.d.ts → target-BBOCeez2.d.ts} +7 -0
- package/dist/{targets-ClWwCzUo.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-QL2IRBIH.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
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.44
|
|
7
|
+
|
|
8
|
+
- `./scene`, **the content gives way to chrome** (additive). `contentMin.chromeWidth` is a lower content floor for
|
|
9
|
+
chrome: compact rails and side toolbar bars may narrow the content down to it while the panel columns keep their
|
|
10
|
+
width and move aside; below it a column shrinks, then folds, as before. A compact rail or a side toolbar bar is
|
|
11
|
+
chrome only on a side with a column template or a declared rail (`isSideBar`), so on a side with neither it gets no
|
|
12
|
+
floor benefit. A floor of 0 or less lets chrome take all the content. The columns alone still leave
|
|
13
|
+
`contentMin.width`. Chrome within that allowance is quiet: content it narrows between the two floors carries no
|
|
14
|
+
`content-narrow`, and `columnRoom` stays true (no `no-column-room`), so a toolbar rail never flips a host to its
|
|
15
|
+
narrow layout. `content-narrow` fires when the columns' own need takes the content under `contentMin.width`, or once
|
|
16
|
+
it is under the floor; its `min` is `contentMin.width` less what chrome takes within the allowance (a host that says
|
|
17
|
+
"needs at least …" reads `contentMin.width`, not the note's `min`). Width only: top
|
|
18
|
+
and bottom bars keep giving way by `contentMin.height`. A floor above
|
|
19
|
+
`contentMin.width`, or one that isn't a number, changes nothing. Scenes without it lay out and target exactly as
|
|
20
|
+
before.
|
|
21
|
+
|
|
22
|
+
## 26.11.43
|
|
23
|
+
|
|
24
|
+
- `./scene`, **`Target.roomHit`** (additive): a target that opens its room and changes an edge's thickness around the
|
|
25
|
+
content (an empty rail beside a column, a new-column line, an empty bar's strip) carries the smallest rect holding its
|
|
26
|
+
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
|
|
27
|
+
pointer that drifts inside the rail it opened keeps it. A refusal or a place no more precise under the held room
|
|
28
|
+
doesn't take over; those places are reachable once the pointer leaves the room. While a shown empty bar's room is
|
|
29
|
+
open, an equal-priority gap under it (for example a corner gap of a side bar) is reachable only after the pointer
|
|
30
|
+
leaves that room. Rail drop strips don't carry it.
|
|
31
|
+
|
|
32
|
+
- `./scene`, **an empty rail or bar is entered over its drawn depth** (behavior). Its targets' hits run as deep as a
|
|
33
|
+
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;
|
|
34
|
+
past the thin band that depth never takes the zones of a drawn edge that take the item. An empty column keeps the thin
|
|
35
|
+
band.
|
|
36
|
+
|
|
37
|
+
- `./scene`, **`EDGE_ROOM_HOLD` is 0** (behavior, was 70 ms). A rail target or a new-column line against the window's
|
|
38
|
+
left or right edge shows with its room on the frame an aiming pointer enters it, so a toolbar held at the edge no
|
|
39
|
+
longer jumps away across the column and back. Grazing the edge with a held item now opens its rail. The accepted cost:
|
|
40
|
+
over recorded sweeps along the window's edges, about 29 rail openings instead of 20, mostly from grazing the edge.
|
|
41
|
+
|
|
6
42
|
## 26.11.42
|
|
7
43
|
|
|
8
44
|
- `./scene`, docs: **a refused place is never drawn.** The docs no longer suggest a tint or outline over `refusals()`:
|
package/README.md
CHANGED
|
@@ -1004,6 +1004,17 @@ first column. A column folds:
|
|
|
1004
1004
|
is oldest first, the outer first, the left first (`column-shrunk`, `column-folded`, `kept-folded`). Under `previous`,
|
|
1005
1005
|
what gave way stays so while the content still fits, room that comes back unfolds in the reverse order, and ages alone
|
|
1006
1006
|
change nothing. Still too narrow: `content-narrow`; under `contentMin.height` (overlay bars counted): `content-short`.
|
|
1007
|
+
With `contentMin.chromeWidth`, a lower floor for chrome, the content gives way first: compact rails and side toolbar
|
|
1008
|
+
bars may take it down to that floor while the columns keep their width and move aside, and only below it does a
|
|
1009
|
+
column shrink, then fold. A compact rail or a side toolbar bar is chrome only where its side has a column template or
|
|
1010
|
+
a declared rail to tell it from a panel column (`isSideBar`), so on a side with neither it gets no floor benefit. A
|
|
1011
|
+
floor of 0 or less lets chrome take all the content. The columns alone still leave `contentMin.width`, so a toolbar
|
|
1012
|
+
rail added at a window's edge narrows the content and leaves the panel column as it was. Chrome within that allowance is quiet: no `content-narrow`,
|
|
1013
|
+
and `columnRoom` stays true, so a toolbar rail never flips a host to its narrow layout. `content-narrow` fires when
|
|
1014
|
+
the columns' own need takes the content under `contentMin.width`, or once it is under the floor; its `min` is
|
|
1015
|
+
`contentMin.width` less what chrome takes within the allowance, so a host that says "needs at least …" reads
|
|
1016
|
+
`contentMin.width`, not the note's `min`. Bars keep giving way by `contentMin.height` (the
|
|
1017
|
+
floor is width only).
|
|
1007
1018
|
- by hand: when every member is folded by hand (`from` over 0) it goes to the rail; with `handFold: "ride"` a one-member
|
|
1008
1019
|
column instead rides as a title bar over the side's first open column, at that column's width, taking no width
|
|
1009
1020
|
(`rides`), while the side has an open column.
|
|
@@ -1246,10 +1257,18 @@ facing halves is home's, and is no target of its own. The slot is where the item
|
|
|
1246
1257
|
columns) carries `opensRoom`, and the drag intent shows it and reports `room` in the same frame. An item of the edge
|
|
1247
1258
|
the dragged item leaves counts when the drop pushes it, not when it only closes up over that place; the items of the
|
|
1248
1259
|
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` (
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1260
|
+
= `EDGE_ROOM_HOLD` (0 ms: it shows on the frame an aiming pointer enters it) on a rail target or a new-column line
|
|
1261
|
+
against the window's left or right edge, so a toolbar held at the edge never jumps away across the column and back
|
|
1262
|
+
(grazing the edge opens the rail); the intent's `roomAfter` (160 ms) on any other; on a rail drop strip's target, also
|
|
1263
|
+
marked, none past the dwell that arms it. A release before it shows still lands on it. A host that draws only a marker
|
|
1264
|
+
opens the room on `frame.room && frame.shown?.opensRoom`, for every one of them. An empty rail or bar is entered over
|
|
1265
|
+
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
|
|
1266
|
+
the zones of a drawn edge that take the item, and an empty column keeps the thin band. A target whose drop changes an
|
|
1267
|
+
edge's thickness around the content (an empty rail beside a column, a new-column line, an empty bar's strip) also
|
|
1268
|
+
carries `roomHit`, the smallest rect holding its hit and its landing rect. While it shows with its room open, the drag
|
|
1269
|
+
intent holds it there: the drawn room is its zone, so a refusal or a place no more precise under it doesn't take
|
|
1270
|
+
over, and those places are reachable once the pointer leaves the room. A rail drop strip (`armedHit`) doesn't carry
|
|
1271
|
+
it.
|
|
1253
1272
|
Every target keeps a reachable hit: its largest piece is at least 12 px across by 24 px along (`minHit`, data per
|
|
1254
1273
|
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
|
|
1255
1274
|
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 * 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\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,7 +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 =
|
|
30
|
+
var EDGE_ROOM_HOLD = 0;
|
|
31
31
|
var DEFAULT_STRIP = 24;
|
|
32
32
|
var DEFAULT_HIT_BAND = 24;
|
|
33
33
|
var DEFAULT_FLOAT_SIZE = { width: 280, height: 360 };
|
|
@@ -854,7 +854,7 @@ function insetReach(area2, f) {
|
|
|
854
854
|
function contentNotes(d, content) {
|
|
855
855
|
const { scene, notes, previous } = d;
|
|
856
856
|
if (scene.contentMin) {
|
|
857
|
-
const minW = px(scene.contentMin.width);
|
|
857
|
+
const minW = px(scene.contentMin.width) - (d.chromeAllowance ?? 0);
|
|
858
858
|
const minH = px(scene.contentMin.height);
|
|
859
859
|
if (content.width < minW - EPS) notes.push({ code: "content-narrow", width: content.width, min: minW });
|
|
860
860
|
const bars = d.order.filter((e) => e.mode === "overlay" && !isSide(e)).reduce((s, e) => s + (d.edges[e.id]?.cross ?? 0), 0);
|
|
@@ -868,6 +868,7 @@ function contentNotes(d, content) {
|
|
|
868
868
|
}
|
|
869
869
|
|
|
870
870
|
// src/scene/solve/columns.ts
|
|
871
|
+
var isChrome = (scene, c) => !c.dyn && isSideBar(scene, c.edge);
|
|
871
872
|
function columnsOf(d, sideEdges, area2, tall) {
|
|
872
873
|
const { scene } = d;
|
|
873
874
|
return sideEdges.map((edge) => {
|
|
@@ -897,6 +898,10 @@ function giveWay(d, cols, area2, gutter) {
|
|
|
897
898
|
const { scene, previous, fresh, opened } = d;
|
|
898
899
|
const ride = scene.handFold === "ride";
|
|
899
900
|
const cmin = scene.contentMin ? px(scene.contentMin.width) : void 0;
|
|
901
|
+
const chromeWidth = scene.contentMin?.chromeWidth;
|
|
902
|
+
const floor = cmin !== void 0 && typeof chromeWidth === "number" && Number.isFinite(chromeWidth) ? Math.min(cmin, px(chromeWidth)) : void 0;
|
|
903
|
+
const chrome = floor === void 0 ? 0 : cols.filter((c) => isChrome(scene, c) && c.width > 0).reduce((s, c) => s + c.width + (c.edge.outsideInset === true ? 0 : gutter), 0);
|
|
904
|
+
if (floor !== void 0) d.chromeAllowance = Math.min(chrome, cmin - floor);
|
|
900
905
|
const foldOrder = cols.filter((c) => c.dyn && !c.hand && c.width > 0).sort((a, b) => giveWayOrder(a, b) || (a.side === b.side ? 0 : a.side === "left" ? -1 : 1));
|
|
901
906
|
const shrunkBefore = (previous?.notes ?? []).flatMap((n) => n.code === "column-shrunk" ? [n.edge] : []);
|
|
902
907
|
const rankOf = (c) => shrunkBefore.includes(c.edge.id) ? shrunkBefore.indexOf(c.edge.id) : Infinity;
|
|
@@ -911,7 +916,7 @@ function giveWay(d, cols, area2, gutter) {
|
|
|
911
916
|
let used = 0;
|
|
912
917
|
for (const [c, w] of widths) used += w > 0 ? w + (c.edge.outsideInset === true ? 0 : gutter) : 0;
|
|
913
918
|
for (const s of railSides) used += railW(s) + gutter;
|
|
914
|
-
let excess = cmin === void 0 ? -Infinity : used + cmin - area2.width;
|
|
919
|
+
let excess = cmin === void 0 ? -Infinity : floor === void 0 ? used + cmin - area2.width : Math.max(used - chrome + cmin, used + floor) - area2.width;
|
|
915
920
|
for (const c of shrinkOrder) {
|
|
916
921
|
if (excess <= EPS) break;
|
|
917
922
|
const w = widths.get(c);
|
|
@@ -970,7 +975,8 @@ function columnRoom(d, cols, area2, f) {
|
|
|
970
975
|
});
|
|
971
976
|
const colMins = open2.length > 0 ? open2 : templates;
|
|
972
977
|
if (cmin === void 0 || colMins.length === 0) return;
|
|
973
|
-
const
|
|
978
|
+
const allBars = cols.filter((c) => c.width > 0 && isChrome(scene, c)).reduce((s, c) => s + c.width + (c.edge.outsideInset === true ? 0 : f.gutter), 0);
|
|
979
|
+
const bars = d.chromeAllowance === void 0 ? allBars : allBars - Math.min(allBars, d.chromeAllowance);
|
|
974
980
|
const width = area2.width - bars - (scene.insetWhen === "docked" && !f.docked ? px(scene.inset?.left) + px(scene.inset?.right) : 0);
|
|
975
981
|
const need = cmin + Math.min(...colMins) + f.gutter;
|
|
976
982
|
d.columnRoom = width >= need - EPS;
|
|
@@ -2021,7 +2027,9 @@ function edgeSpec(c, edge) {
|
|
|
2021
2027
|
const strip = Math.max(0, Number.isFinite(edge.strip) ? edge.strip : DEFAULT_STRIP);
|
|
2022
2028
|
const outer = edge.side === "left" ? r.x : edge.side === "right" ? r.x + r.width : edge.side === "top" ? r.y : r.y + r.height;
|
|
2023
2029
|
const inward = (depth) => edge.side === "left" || edge.side === "top" ? [outer, outer + depth] : [outer - depth, outer];
|
|
2024
|
-
const
|
|
2030
|
+
const thin = edgeKind === "rail" || edgeKind === "bar" || edgeKind === "barBetween";
|
|
2031
|
+
const landed = el.cross > 0 || !thin ? 0 : Math.max(0, ...slots.map((s) => s.result.layout.edges[edge.id]?.cross ?? 0));
|
|
2032
|
+
const across2 = (after) => inward((el.cross > 0 ? Math.max(el.cross, after?.edges[edge.id]?.cross ?? 0) : Math.max(strip, landed)) + data.inward);
|
|
2025
2033
|
const drawn = el.cross > 0;
|
|
2026
2034
|
const marker = (s) => {
|
|
2027
2035
|
const slot = s.result.layout.items[dragged].rect;
|
|
@@ -2043,7 +2051,8 @@ function edgeSpec(c, edge) {
|
|
|
2043
2051
|
reserved,
|
|
2044
2052
|
cards,
|
|
2045
2053
|
across: across2,
|
|
2046
|
-
owned: inward(drawn ? el.cross : Math.min(strip, data.place)),
|
|
2054
|
+
owned: inward(drawn ? el.cross : landed > 0 ? landed : Math.min(strip, data.place)),
|
|
2055
|
+
...!drawn && landed > Math.min(strip, data.place) ? { thinOwned: inward(Math.min(strip, data.place)) } : {},
|
|
2047
2056
|
ownedAlong: null,
|
|
2048
2057
|
drawn,
|
|
2049
2058
|
marker
|
|
@@ -2139,15 +2148,15 @@ function homeRectOf(c, ownSpec) {
|
|
|
2139
2148
|
const own = c.now.items[c.dragged];
|
|
2140
2149
|
if (!own || own.floating || !own.edge) return null;
|
|
2141
2150
|
const o = own.rect;
|
|
2142
|
-
const
|
|
2151
|
+
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));
|
|
2143
2152
|
if (own.inMenu) return o;
|
|
2144
2153
|
if (!ownSpec) {
|
|
2145
2154
|
const e = c.now.edges[own.edge];
|
|
2146
2155
|
const vanishes = !c.rest.edges.some((x) => x.id === own.edge);
|
|
2147
|
-
return e && vanishes && !e.folded && !e.rides && area(e.rect) > EPS ?
|
|
2156
|
+
return e && vanishes && !e.folded && !e.rides && area(e.rect) > EPS ? hull2(o, e.rect) : o;
|
|
2148
2157
|
}
|
|
2149
2158
|
const [c0, c1] = ownSpec.across();
|
|
2150
|
-
return ownSpec.vertical ?
|
|
2159
|
+
return ownSpec.vertical ? hull2(o, rect(c0, o.y, c1 - c0, o.height)) : hull2(o, rect(o.x, c0, o.width, c1 - c0));
|
|
2151
2160
|
}
|
|
2152
2161
|
function ownersOf(c, live, drawn, alongOf) {
|
|
2153
2162
|
const ownEdge = c.now.items[c.dragged]?.edge;
|
|
@@ -2159,7 +2168,12 @@ function ownersOf(c, live, drawn, alongOf) {
|
|
|
2159
2168
|
// Every edge the tiler reads, along each zone with a slot the filter keeps: what it owns, drawn or a band of its
|
|
2160
2169
|
// place (a column line's band about its line). A zone whose every slot is refused owns nothing against the others
|
|
2161
2170
|
// (its drawn rect still counts, below).
|
|
2162
|
-
...live.flatMap((s) =>
|
|
2171
|
+
...live.flatMap((s) => {
|
|
2172
|
+
const rects = ownedRectsOf(s, alongOf(s));
|
|
2173
|
+
if (!s.thinOwned) return rects.map((r) => ({ spec: s, rect: r, lay: s.lay, place: !s.drawn }));
|
|
2174
|
+
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]));
|
|
2175
|
+
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 }))]);
|
|
2176
|
+
}).filter((o) => area(o.rect) > EPS),
|
|
2163
2177
|
// Every seen rect: the edges the tiler doesn't read (folded, riding, taking nothing) among them.
|
|
2164
2178
|
...drawn.map((d) => ({ ...d, place: false }))
|
|
2165
2179
|
];
|
|
@@ -2175,12 +2189,19 @@ function ownership(c, live, alongOf) {
|
|
|
2175
2189
|
const place = !s.drawn;
|
|
2176
2190
|
return o.place === place ? !place || o.lay.at < s.lay.at : !o.place;
|
|
2177
2191
|
};
|
|
2192
|
+
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])) : [];
|
|
2193
|
+
const thinRectOf = (s) => {
|
|
2194
|
+
const b = bandOf(s);
|
|
2195
|
+
const [t0, t1] = s.thinOwned;
|
|
2196
|
+
return s.vertical ? rect(t0, b.y, t1 - t0, b.height) : rect(b.x, t0, b.width, t1 - t0);
|
|
2197
|
+
};
|
|
2178
2198
|
const taken = new Map(
|
|
2179
2199
|
live.map((s) => [
|
|
2180
2200
|
s,
|
|
2181
2201
|
[
|
|
2182
|
-
...owners.filter((o) => wins(o, s)).
|
|
2183
|
-
...EDGE_KINDS[s.kind].virtual ? owners.filter((o) => o.spec !== s && !wins(o, s)).flatMap((o) => subtract(o.rect, ownedRectOf(s))) : []
|
|
2202
|
+
...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]),
|
|
2203
|
+
...EDGE_KINDS[s.kind].virtual ? owners.filter((o) => o.spec !== s && !wins(o, s)).flatMap((o) => subtract(o.rect, ownedRectOf(s))) : [],
|
|
2204
|
+
...s.thinOwned ? live.filter((d) => d !== s).flatMap((d) => takingRects(d).flatMap((t) => subtract(t, thinRectOf(s)))) : []
|
|
2184
2205
|
]
|
|
2185
2206
|
])
|
|
2186
2207
|
);
|
|
@@ -2998,11 +3019,22 @@ function emit2(c, placed) {
|
|
|
2998
3019
|
}
|
|
2999
3020
|
const result = t.result;
|
|
3000
3021
|
const atEdge = WINDOW_EDGE_KINDS.has(t.edgeKind) && touchesSide(scene.stage, t.hits ?? [t.hit]);
|
|
3001
|
-
const
|
|
3022
|
+
const thickens = thicknessChanges(now, result.layout);
|
|
3023
|
+
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) } : {} } : {};
|
|
3002
3024
|
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 });
|
|
3003
3025
|
}
|
|
3004
3026
|
return { targets: targets2, refused, ownHome };
|
|
3005
3027
|
}
|
|
3028
|
+
function hull(a, b) {
|
|
3029
|
+
const x = Math.min(a.x, b.x);
|
|
3030
|
+
const y = Math.min(a.y, b.y);
|
|
3031
|
+
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);
|
|
3032
|
+
}
|
|
3033
|
+
var thicknessChanges = (now, after) => {
|
|
3034
|
+
const a = now.content;
|
|
3035
|
+
const b = after.content;
|
|
3036
|
+
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;
|
|
3037
|
+
};
|
|
3006
3038
|
var WINDOW_EDGE_KINDS = /* @__PURE__ */ new Set(["rail", "railStop", "sideBar", "columnLine"]);
|
|
3007
3039
|
var touchesSide = (stage, pieces) => pieces.some((r) => r.x <= stage.x + EPS || r.x + r.width >= stage.x + stage.width - EPS);
|
|
3008
3040
|
function slotOverMoved(now, lifted, after, slot, dragged, onto) {
|
|
@@ -3115,7 +3147,8 @@ function generateShown(scene, dragged, options, hidden) {
|
|
|
3115
3147
|
const zones = /* @__PURE__ */ new Map();
|
|
3116
3148
|
for (const t of [...alone.values()].flat()) if (t.kind !== "refuse" && t.id) zones.set(t.id, [...zones.get(t.id) ?? [], t.hit]);
|
|
3117
3149
|
const bounds = stageOf(scene);
|
|
3118
|
-
|
|
3150
|
+
const held = withMinHit(c, layered.targets, layered.refusals, zones).map((t) => t.roomHit && t.slot ? { ...t, roomHit: hull(t.hit, t.slot) } : t);
|
|
3151
|
+
return { targets: held, refusals: layered.refusals.map((r) => ({ ...r, bounds })), lost: lostIds, zones };
|
|
3119
3152
|
}
|
|
3120
3153
|
var stageOf = (scene) => rect(scene.stage.x, scene.stage.y, scene.stage.width, scene.stage.height);
|
|
3121
3154
|
function targets(scene, dragged, options = {}) {
|
|
@@ -3224,4 +3257,4 @@ export {
|
|
|
3224
3257
|
refusalTargets,
|
|
3225
3258
|
stops
|
|
3226
3259
|
};
|
|
3227
|
-
//# sourceMappingURL=chunk-
|
|
3260
|
+
//# sourceMappingURL=chunk-32BGJAJA.js.map
|