@n-uf/placement 26.12.7 → 26.12.8
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 +42 -0
- package/dist/tiling.d.ts +152 -31
- package/dist/tiling.js +250 -49
- package/dist/tiling.js.map +1 -1
- package/package.json +1 -1
package/dist/tiling.js
CHANGED
|
@@ -389,8 +389,9 @@ function dropFits(projected, dragged, at, area, options) {
|
|
|
389
389
|
refuseFold(options, "dropFits");
|
|
390
390
|
if (!(area.width > 0 && area.height > 0)) return { ok: true };
|
|
391
391
|
const min = px3(options.min);
|
|
392
|
+
const folded = options.folded;
|
|
392
393
|
const fits = (r) => !!r && r.width >= min - EPS && r.height >= min - EPS;
|
|
393
|
-
return fits(projected.get(dragged)) && fits(projected.get(at)) ? { ok: true } : { ok: false, reason: `${options.side} rejected: projected footprint of the two panes violates min ${min}px` };
|
|
394
|
+
return fits(projected.get(dragged)) && (fits(projected.get(at)) || folded?.has(at) === true) ? { ok: true } : { ok: false, reason: `${options.side} rejected: projected footprint of the two panes violates min ${min}px` };
|
|
394
395
|
}
|
|
395
396
|
|
|
396
397
|
// src/tiling/fold-steps.ts
|
|
@@ -655,6 +656,7 @@ var NONE = /* @__PURE__ */ new Set();
|
|
|
655
656
|
var EDGES = ["left", "right", "top", "bottom"];
|
|
656
657
|
var SEGMENT_GAP = 2;
|
|
657
658
|
var RATIO_EPSILON = 1e-9;
|
|
659
|
+
var FLOOR_EPSILON = 1e-9;
|
|
658
660
|
var px5 = (v) => v !== void 0 && Number.isFinite(v) && v > 0 ? v : 0;
|
|
659
661
|
var usable2 = (v) => v !== void 0 && Number.isFinite(v) && v > 0;
|
|
660
662
|
var otherAxis2 = (axis) => axis === "x" ? "y" : "x";
|
|
@@ -907,6 +909,8 @@ function foldLayout(tree, area, options, fold) {
|
|
|
907
909
|
openRect: layout.openRect,
|
|
908
910
|
spine: { ...layout.railRect },
|
|
909
911
|
rail: layout.railRect,
|
|
912
|
+
// Set with the rail's segments, below.
|
|
913
|
+
railContentLength: 0,
|
|
910
914
|
railOf: layout.railOf,
|
|
911
915
|
parent: enclosing.length > 0 ? enclosing[enclosing.length - 1] : null,
|
|
912
916
|
panes: folded,
|
|
@@ -918,18 +922,40 @@ function foldLayout(tree, area, options, fold) {
|
|
|
918
922
|
const onRail = /* @__PURE__ */ new Map();
|
|
919
923
|
folds.forEach((each, index) => onRail.set(each.railOf, [...onRail.get(each.railOf) ?? [], index]));
|
|
920
924
|
const drawn = [...folds];
|
|
925
|
+
const paneParts = folds.map(() => []);
|
|
926
|
+
const asked = px5(fold.segmentFloor);
|
|
921
927
|
for (const members of onRail.values()) {
|
|
922
|
-
if (members.length < 2) continue;
|
|
923
928
|
const head = folds[members[0]];
|
|
924
|
-
const
|
|
925
|
-
|
|
929
|
+
const along = head.axis === "x" ? "height" : "width";
|
|
930
|
+
const length = head.rail[along];
|
|
931
|
+
const shownOf = (i) => folds[i].panes.filter((pane) => weight(pane) > 0);
|
|
932
|
+
const shares = members.length < 2 ? [head.spine] : segments(head.rail, head.axis, members.map((i) => Math.max(1, shownOf(i).length)));
|
|
933
|
+
let spinesOf = shares;
|
|
934
|
+
let partsOf = members.map((i, n) => segments(shares[n], head.axis, shownOf(i).map(() => 1)));
|
|
935
|
+
let content = length;
|
|
936
|
+
const floor = Math.min(asked, length);
|
|
937
|
+
const shortest = Math.min(...members.map((i, n) => shownOf(i).length > 0 ? Math.min(...partsOf[n].map((r) => r[along])) : shares[n][along]));
|
|
938
|
+
if (floor > 0 && shortest < floor - FLOOR_EPSILON) {
|
|
939
|
+
const unit2 = (at2, size) => head.axis === "x" ? { ...head.rail, y: head.rail.y + at2, height: size } : { ...head.rail, x: head.rail.x + at2, width: size };
|
|
940
|
+
let at = 0;
|
|
941
|
+
const floored = [];
|
|
942
|
+
partsOf = members.map((i) => {
|
|
943
|
+
const start = at;
|
|
944
|
+
const parts = [];
|
|
945
|
+
for (let u = 0; u < Math.max(1, shownOf(i).length); u++, at += floor + SEGMENT_GAP) parts.push(unit2(at, floor));
|
|
946
|
+
floored.push(unit2(start, at - SEGMENT_GAP - start));
|
|
947
|
+
return shownOf(i).length > 0 ? parts : [];
|
|
948
|
+
});
|
|
949
|
+
spinesOf = floored;
|
|
950
|
+
content = Math.max(length, at - SEGMENT_GAP);
|
|
951
|
+
}
|
|
952
|
+
members.forEach((i, n) => {
|
|
953
|
+
drawn[i] = { ...folds[i], spine: { ...spinesOf[n] }, railContentLength: content };
|
|
954
|
+
paneParts[i] = partsOf[n];
|
|
955
|
+
});
|
|
926
956
|
}
|
|
927
957
|
const spines = /* @__PURE__ */ new Map();
|
|
928
|
-
|
|
929
|
-
const shown = each.panes.filter((pane) => weight(pane) > 0);
|
|
930
|
-
const parts = segments(each.spine, each.axis, shown.map(() => 1));
|
|
931
|
-
shown.forEach((pane, n) => spines.set(pane, parts[n]));
|
|
932
|
-
}
|
|
958
|
+
drawn.forEach((each, i) => each.panes.filter((pane) => weight(pane) > 0).forEach((pane, n) => spines.set(pane, paneParts[i][n])));
|
|
933
959
|
if (drawn.length === 0 && !drawnAt.moved) {
|
|
934
960
|
const out = /* @__PURE__ */ new Map();
|
|
935
961
|
for (const [id, geometry] of base.splits) {
|
|
@@ -946,6 +972,47 @@ function layoutSplitTree(tree, area, options = {}) {
|
|
|
946
972
|
if (options.fold) return foldLayout(tree, area, options, options.fold);
|
|
947
973
|
return { ...laySplitTree(tree, area, options), spines: /* @__PURE__ */ new Map(), folds: [] };
|
|
948
974
|
}
|
|
975
|
+
var withOrder = (options, order) => options.fold ? { ...options, fold: { ...options.fold, order } } : options;
|
|
976
|
+
|
|
977
|
+
// src/tiling/painted.ts
|
|
978
|
+
function offsetOf(folds, index, railOffset) {
|
|
979
|
+
const v = railOffset?.(folds[index], index);
|
|
980
|
+
return typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
981
|
+
}
|
|
982
|
+
function paint(r, axis, offset, box) {
|
|
983
|
+
if (axis === "x") {
|
|
984
|
+
const y0 = Math.max(r.y - offset, box.y);
|
|
985
|
+
const y1 = Math.min(r.y - offset + r.height, box.y + box.height);
|
|
986
|
+
return y1 > y0 ? { x: r.x, y: y0, width: r.width, height: y1 - y0 } : null;
|
|
987
|
+
}
|
|
988
|
+
const x0 = Math.max(r.x - offset, box.x);
|
|
989
|
+
const x1 = Math.min(r.x - offset + r.width, box.x + box.width);
|
|
990
|
+
return x1 > x0 ? { x: x0, y: r.y, width: x1 - x0, height: r.height } : null;
|
|
991
|
+
}
|
|
992
|
+
function paintedSpines(layout, railOffset) {
|
|
993
|
+
const out = /* @__PURE__ */ new Map();
|
|
994
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
995
|
+
for (const fold of layout.folds) {
|
|
996
|
+
const head = layout.folds[fold.railOf];
|
|
997
|
+
let offset = offsets.get(fold.railOf);
|
|
998
|
+
if (offset === void 0) offsets.set(fold.railOf, offset = offsetOf(layout.folds, fold.railOf, railOffset));
|
|
999
|
+
for (const pane of fold.panes) {
|
|
1000
|
+
const r = layout.spines.get(pane);
|
|
1001
|
+
if (!r) continue;
|
|
1002
|
+
const painted = paint(r, head.axis, offset, head.rail);
|
|
1003
|
+
if (painted) out.set(pane, painted);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
return out;
|
|
1007
|
+
}
|
|
1008
|
+
function railAt(layout, point, railOffset) {
|
|
1009
|
+
const rail = layout.folds.findIndex((f, i) => f.railOf === i && contains(f.rail, point, 0));
|
|
1010
|
+
if (rail < 0) return null;
|
|
1011
|
+
for (const [pane, r] of paintedSpines(layout, railOffset)) {
|
|
1012
|
+
if (layout.folds.some((f) => f.railOf === rail && f.panes.includes(pane)) && contains(r, point, 0)) return { rail, pane };
|
|
1013
|
+
}
|
|
1014
|
+
return { rail, pane: null };
|
|
1015
|
+
}
|
|
949
1016
|
|
|
950
1017
|
// src/tiling/regions.ts
|
|
951
1018
|
var PANE_SIDES = ["top", "right", "bottom", "left"];
|
|
@@ -1121,13 +1188,18 @@ function createTilingHit(ctx, basis, options = {}) {
|
|
|
1121
1188
|
const stackOf = (t, k) => ops.stackOf?.(t, k) ?? null;
|
|
1122
1189
|
const drawnAs = (t, k) => stackOf(t, k)?.active ?? k;
|
|
1123
1190
|
const subjectDrawn = drawnAs(lift.tree, ctx.subjectKey);
|
|
1191
|
+
const baseFolded = new Set(base.folds.flatMap((f) => f.panes));
|
|
1192
|
+
const railBoxes = laid.folds.filter((f, i) => f.railOf === i).map((f) => f.rail);
|
|
1193
|
+
const onRail = (p) => railBoxes.some((r) => inside(r, p));
|
|
1194
|
+
const offsets = basis === "lift" ? ctx.railOffset : void 0;
|
|
1195
|
+
const foldedAt = (p) => onRail(p) ? railAt(laid, p, offsets) : null;
|
|
1124
1196
|
const atOf = (pane) => {
|
|
1125
|
-
if (base.layout.has(pane)) return pane;
|
|
1197
|
+
if (base.layout.has(pane) || baseFolded.has(pane)) return pane;
|
|
1126
1198
|
const members = stackOf(laid.tree, pane)?.members ?? [];
|
|
1127
1199
|
for (const m of members) {
|
|
1128
1200
|
if (ctx.inSubject(m)) continue;
|
|
1129
1201
|
const d = drawnAs(base.tree, m);
|
|
1130
|
-
if (base.layout.has(d)) return d;
|
|
1202
|
+
if (base.layout.has(d) || baseFolded.has(d)) return d;
|
|
1131
1203
|
}
|
|
1132
1204
|
return null;
|
|
1133
1205
|
};
|
|
@@ -1178,8 +1250,10 @@ function createTilingHit(ctx, basis, options = {}) {
|
|
|
1178
1250
|
};
|
|
1179
1251
|
const liftArrangement = arrangementOf(ops.normalize ? ops.normalize(lift.tree) : lift.tree);
|
|
1180
1252
|
const homeMemo = /* @__PURE__ */ new Map();
|
|
1253
|
+
const carriedIn = lift.spines.has(subjectDrawn);
|
|
1181
1254
|
const homeLike = (p) => {
|
|
1182
1255
|
if (p === homePlace) return true;
|
|
1256
|
+
if (carriedIn) return false;
|
|
1183
1257
|
let v = homeMemo.get(p.id);
|
|
1184
1258
|
if (v === void 0) {
|
|
1185
1259
|
v = live(p) && (after(p.held).tree === lift.tree || arrangementOf(after(p.held).tree) === liftArrangement);
|
|
@@ -1277,6 +1351,7 @@ function createTilingHit(ctx, basis, options = {}) {
|
|
|
1277
1351
|
}
|
|
1278
1352
|
Object.freeze(targets);
|
|
1279
1353
|
const rawAt = (p) => {
|
|
1354
|
+
if (onRail(p)) return { place: null, refused: null };
|
|
1280
1355
|
if (home && inside(home, p)) return { place: homePlace, refused: null };
|
|
1281
1356
|
const pane = panes.find((ph) => inside(ph.body.hit, p));
|
|
1282
1357
|
if (!pane) return { place: null, refused: null };
|
|
@@ -1322,6 +1397,7 @@ function createTilingHit(ctx, basis, options = {}) {
|
|
|
1322
1397
|
return ((p.x - from.x) / rx) ** 2 + ((p.y - from.y) / ry) ** 2 < 1;
|
|
1323
1398
|
};
|
|
1324
1399
|
const hold = (state2, p) => {
|
|
1400
|
+
if (onRail(p)) return null;
|
|
1325
1401
|
const now = effective(rawAt(p).place);
|
|
1326
1402
|
if (state2) {
|
|
1327
1403
|
if (now && now.id === state2.place) return state2;
|
|
@@ -1357,7 +1433,7 @@ function createTilingHit(ctx, basis, options = {}) {
|
|
|
1357
1433
|
const shown = place && place !== homePlace && frame.shown && place.owners.has(frame.shown.id) ? place : null;
|
|
1358
1434
|
const held = place === homePlace ? HOME : shown?.held ?? null;
|
|
1359
1435
|
const refused = held ? null : rawAt(p).refused?.held ?? null;
|
|
1360
|
-
return { held, refused, mark: basis === "lift" && shown ? markOf(shown) : null };
|
|
1436
|
+
return { held, refused, mark: basis === "lift" && shown ? markOf(shown) : null, folded: foldedAt(p) };
|
|
1361
1437
|
};
|
|
1362
1438
|
return {
|
|
1363
1439
|
basis,
|
|
@@ -1372,6 +1448,7 @@ function createTilingHit(ctx, basis, options = {}) {
|
|
|
1372
1448
|
heldOf: (id) => byId.get(id)?.held ?? null,
|
|
1373
1449
|
placeOf: (t, p) => placeOf(t, p),
|
|
1374
1450
|
read,
|
|
1451
|
+
foldedAt,
|
|
1375
1452
|
drawn: (r) => basis === "lift" ? lift : r.held === null ? base : r.held.kind === "home" ? lift : after(r.held),
|
|
1376
1453
|
release: (r) => after(r.held ?? HOME)
|
|
1377
1454
|
};
|
|
@@ -1408,26 +1485,39 @@ function giveWay(panes, layout, min, age) {
|
|
|
1408
1485
|
// src/tiling/drag.ts
|
|
1409
1486
|
var sameRect = (a, b) => Math.abs(a.x - b.x) <= EPS && Math.abs(a.y - b.y) <= EPS && Math.abs(a.width - b.width) <= EPS && Math.abs(a.height - b.height) <= EPS;
|
|
1410
1487
|
var px6 = (v) => v !== void 0 && Number.isFinite(v) && v > 0 ? v : 0;
|
|
1488
|
+
var foldedOf = (folds) => new Set(folds.flatMap((f) => f.panes));
|
|
1489
|
+
function keyed(lists) {
|
|
1490
|
+
const out = /* @__PURE__ */ new Set();
|
|
1491
|
+
for (const list of lists) for (const k of list) out.add(k);
|
|
1492
|
+
return [...out];
|
|
1493
|
+
}
|
|
1494
|
+
var openFirst = (laid) => keyed([laid.order.filter((k) => laid.layout.has(k)), [...laid.layout.keys()], laid.order]);
|
|
1411
1495
|
function tilingDrag(tree, subject, options) {
|
|
1412
|
-
refuseFold(options, "tilingDrag");
|
|
1413
1496
|
const { ops, area } = options;
|
|
1414
1497
|
const normalize = (t) => ops.normalize ? ops.normalize(t) : t;
|
|
1415
|
-
const lay2 = (t) => {
|
|
1416
|
-
const { panes, splits } = layoutSplitTree(ops.split(t), area, options);
|
|
1417
|
-
return { tree: t, layout: panes, splits };
|
|
1498
|
+
const lay2 = (t, order) => {
|
|
1499
|
+
const { panes, splits, spines, folds } = layoutSplitTree(ops.split(t), area, withOrder(options, order));
|
|
1500
|
+
return { tree: t, layout: panes, splits, spines, folds, order: options.fold ? order : [] };
|
|
1418
1501
|
};
|
|
1419
1502
|
const stackOf = (t, pane) => ops.stackOf?.(t, pane) ?? null;
|
|
1420
1503
|
const drawnAs = (t, pane) => stackOf(t, pane)?.active ?? pane;
|
|
1421
1504
|
const subjectKey = subject.kind === "pane" ? subject.pane : subject.stack.active;
|
|
1422
|
-
const lift = lay2(tree);
|
|
1423
|
-
const
|
|
1505
|
+
const lift = lay2(tree, options.fold?.order ?? []);
|
|
1506
|
+
const liftKey = drawnAs(tree, subjectKey);
|
|
1507
|
+
const liftRect = lift.layout.get(liftKey) ?? lift.spines.get(liftKey);
|
|
1424
1508
|
if (!liftRect) {
|
|
1425
1509
|
const what = subject.kind === "pane" ? `pane ${String(subject.pane)}` : `stack ${subject.stack.id}`;
|
|
1426
|
-
|
|
1510
|
+
const drawn = options.fold ? "drawn (open or on a spine)" : "drawn";
|
|
1511
|
+
throw new Error(`tilingDrag: the subject (${what}) is not in the tree: it is neither ${drawn} nor a member of a drawn stack`);
|
|
1427
1512
|
}
|
|
1428
|
-
const
|
|
1513
|
+
const mates = subject.kind === "pane" ? (stackOf(tree, subjectKey)?.members ?? []).filter((m) => m !== subjectKey) : [];
|
|
1514
|
+
const liftOrder = openFirst(lift);
|
|
1515
|
+
const baseOrder = keyed([liftOrder.flatMap((k) => k === liftKey ? [k, ...mates] : [k]), mates]);
|
|
1516
|
+
const base = lay2(ops.release(tree, subject), baseOrder);
|
|
1429
1517
|
const takesPane = panesOf(ops.split(base.tree)).length < panesOf(ops.split(tree)).length;
|
|
1430
|
-
const home = takesPane ? { ...liftRect } : null;
|
|
1518
|
+
const home = takesPane && lift.layout.has(liftKey) ? { ...liftRect } : null;
|
|
1519
|
+
const liftFolded = foldedOf(lift.folds);
|
|
1520
|
+
const baseFolded = foldedOf(base.folds);
|
|
1431
1521
|
const movedIn = (laid) => {
|
|
1432
1522
|
const own = drawnAs(laid.tree, subjectKey);
|
|
1433
1523
|
const out = [];
|
|
@@ -1438,6 +1528,11 @@ function tilingDrag(tree, subject, options) {
|
|
|
1438
1528
|
}
|
|
1439
1529
|
return out;
|
|
1440
1530
|
};
|
|
1531
|
+
const foldChangesIn = (laid) => {
|
|
1532
|
+
if (!options.fold) return { opened: [], closed: [] };
|
|
1533
|
+
const folded = foldedOf(laid.folds);
|
|
1534
|
+
return { opened: [...laid.layout.keys()].filter((k) => liftFolded.has(k)), closed: [...lift.layout.keys()].filter((k) => folded.has(k)) };
|
|
1535
|
+
};
|
|
1441
1536
|
const inSubject = (pane) => subject.kind === "pane" ? pane === subject.pane : subject.stack.members.includes(pane);
|
|
1442
1537
|
const refusalBefore = (held) => {
|
|
1443
1538
|
const at = held.at;
|
|
@@ -1446,12 +1541,12 @@ function tilingDrag(tree, subject, options) {
|
|
|
1446
1541
|
const own = stackOf(tree, subjectKey);
|
|
1447
1542
|
if (own && stackOf(tree, at)?.id === own.id) return { code: "self" };
|
|
1448
1543
|
}
|
|
1449
|
-
if (!base.layout.has(at)) return { code: "missing" };
|
|
1544
|
+
if (!base.layout.has(at)) return baseFolded.has(at) ? { code: "folded" } : { code: "missing" };
|
|
1450
1545
|
if (options.still?.(at)) return { code: "still" };
|
|
1451
1546
|
if (held.kind === "join" && !ops.join) return { code: "join" };
|
|
1452
1547
|
return null;
|
|
1453
1548
|
};
|
|
1454
|
-
const refused = (held, refusal) => ({ ...lift, held, refusal, landing: null, moved: [] });
|
|
1549
|
+
const refused = (held, refusal) => ({ ...lift, held, refusal, landing: null, moved: [], opened: [], closed: [] });
|
|
1455
1550
|
const roomFor = (at, side) => {
|
|
1456
1551
|
const r = base.layout.get(at);
|
|
1457
1552
|
if (canSplitPane(r, side, options).ok) return null;
|
|
@@ -1462,18 +1557,25 @@ function tilingDrag(tree, subject, options) {
|
|
|
1462
1557
|
return span < min * 2 + gutter ? { code: "room-along", need: min * 2 + gutter, have: span } : { code: "room-across", need: min, have: along ? r.height : r.width };
|
|
1463
1558
|
};
|
|
1464
1559
|
const make = (held) => {
|
|
1465
|
-
if (held.kind === "home") return { ...lift, held, refusal: null, landing: liftRect, moved: [] };
|
|
1466
|
-
const before = refusalBefore(held) ?? (held.kind === "beside" ? roomFor(held.at, held.side) : null);
|
|
1560
|
+
if (held.kind === "home") return { ...lift, held, refusal: null, landing: liftRect, moved: [], opened: [], closed: [] };
|
|
1561
|
+
const before = refusalBefore(held) ?? (held.kind === "beside" && !options.fold ? roomFor(held.at, held.side) : null);
|
|
1467
1562
|
if (before) return refused(held, before);
|
|
1468
1563
|
const changed = held.kind === "swap" ? ops.swap(tree, subject, held.at) : held.kind === "beside" ? ops.beside(base.tree, subject, held.at, held.side, { kind: "half" }) : ops.join(base.tree, subject, held.at, held.index);
|
|
1469
|
-
const
|
|
1470
|
-
const own = drawnAs(
|
|
1564
|
+
const changedTree = normalize(changed);
|
|
1565
|
+
const own = drawnAs(changedTree, subjectKey);
|
|
1566
|
+
const candidateOrder = keyed([[own], baseOrder]);
|
|
1567
|
+
const laid = lay2(changedTree, candidateOrder);
|
|
1471
1568
|
const partner = drawnAs(laid.tree, held.at);
|
|
1472
|
-
|
|
1569
|
+
const fits = dropFits(laid.layout, own, partner, area, {
|
|
1570
|
+
min: options.min,
|
|
1571
|
+
side: held.kind === "beside" ? held.side : "left",
|
|
1572
|
+
...options.fold ? { folded: foldedOf(laid.folds) } : {}
|
|
1573
|
+
});
|
|
1574
|
+
if (!fits.ok) {
|
|
1473
1575
|
const small = (r) => !r || r.width < px6(options.min) || r.height < px6(options.min);
|
|
1474
1576
|
return refused(held, { code: "fit", pane: small(laid.layout.get(own)) ? own : partner });
|
|
1475
1577
|
}
|
|
1476
|
-
return { ...laid, held, refusal: null, landing: laid.layout.get(own) ?? null, moved: movedIn(laid) };
|
|
1578
|
+
return { ...laid, held, refusal: null, landing: laid.layout.get(own) ?? null, moved: movedIn(laid), ...foldChangesIn(laid) };
|
|
1477
1579
|
};
|
|
1478
1580
|
const homeAfter = make({ kind: "home" });
|
|
1479
1581
|
const memo = /* @__PURE__ */ new Map();
|
|
@@ -1490,7 +1592,7 @@ function tilingDrag(tree, subject, options) {
|
|
|
1490
1592
|
const hits = /* @__PURE__ */ new Map();
|
|
1491
1593
|
const hit = (basis, hitOptions) => {
|
|
1492
1594
|
let h = hits.get(basis);
|
|
1493
|
-
if (!h) hits.set(basis, h = createTilingHit({ ops, lift, base, home, subjectKey, inSubject, ...options.still ? { still: options.still } : {}, after, lay: lay2, changeOf }, basis, hitOptions));
|
|
1595
|
+
if (!h) hits.set(basis, h = createTilingHit({ ops, lift, base, home, subjectKey, inSubject, ...options.still ? { still: options.still } : {}, ...options.railOffset ? { railOffset: options.railOffset } : {}, after, lay: (t) => lay2(t, baseOrder), changeOf }, basis, hitOptions));
|
|
1494
1596
|
return h;
|
|
1495
1597
|
};
|
|
1496
1598
|
return { subject, lift, base, home, after, hit };
|
|
@@ -1593,13 +1695,23 @@ function splitTreeOps(options = {}) {
|
|
|
1593
1695
|
var TILING_PROPERTIES = [
|
|
1594
1696
|
/** `after(home).tree` is the lift tree itself, its layout the lift's, never normalized. */
|
|
1595
1697
|
"home-is-lift",
|
|
1596
|
-
/** `home` is the subject's lift rect when the release takes a drawn pane away, else null. */
|
|
1698
|
+
/** `home` is the subject's lift rect when the release takes a drawn pane away and the lift draws the subject open, else null (a subject on a spine has none). */
|
|
1597
1699
|
"home-is-the-gap",
|
|
1598
1700
|
/** Home lies only over base panes whose rect changed when the subject was released. */
|
|
1599
1701
|
"home-over-changed",
|
|
1600
|
-
/**
|
|
1702
|
+
/**
|
|
1703
|
+
* `after(held).layout` is `after(held).tree` laid out (under a fold with `after(held).order`, its spines and folds
|
|
1704
|
+
* too); the landing is the subject's rect there, drawn open (home's, for a subject on a spine at the lift: its
|
|
1705
|
+
* segment); a refused place is the lift.
|
|
1706
|
+
*/
|
|
1601
1707
|
"one-layout",
|
|
1602
|
-
/**
|
|
1708
|
+
/** Under a fold, every pane the base folds is refused `folded` for every kind of place (a swap with the stack a tab is torn from stays `self`). */
|
|
1709
|
+
"folded-refused",
|
|
1710
|
+
/**
|
|
1711
|
+
* A swap puts the partner in the subject's lift rect and the subject in the partner's, and the others keep theirs.
|
|
1712
|
+
* Not checked under per-child layout callbacks (`fixed`, `fixedAcross`, `floor`), which may move the ratios, nor
|
|
1713
|
+
* under a fold (a swap can change which pane comes first, and so which side of a fold shows).
|
|
1714
|
+
*/
|
|
1603
1715
|
"swap-exchanges",
|
|
1604
1716
|
/** A swap puts the partner in the subject's old slot of the split (as it is drawn there) and the subject in the partner's. Checked under every option, the per-child callbacks included. */
|
|
1605
1717
|
"swap-trades-slots",
|
|
@@ -1665,7 +1777,16 @@ function paneAt(split, path) {
|
|
|
1665
1777
|
return node && "pane" in node ? node.pane : void 0;
|
|
1666
1778
|
}
|
|
1667
1779
|
var sameList = (a, b) => a.length === b.length && a.every((k, i) => Object.is(k, b[i]));
|
|
1668
|
-
var
|
|
1780
|
+
var showHeld = (h) => h.kind === "home" ? "home" : `${h.kind} ${String(h.at)}${h.kind === "beside" ? ` ${h.side}` : h.kind === "join" && h.index !== void 0 ? ` @${h.index}` : ""}`;
|
|
1781
|
+
var show = showHeld;
|
|
1782
|
+
function liftable(tree, subject, options) {
|
|
1783
|
+
if (!options.fold) return true;
|
|
1784
|
+
const { ops } = options;
|
|
1785
|
+
const key = subject.kind === "pane" ? subject.pane : subject.stack.active;
|
|
1786
|
+
const drawn = ops.stackOf?.(tree, key)?.active ?? key;
|
|
1787
|
+
const lift = layoutSplitTree(ops.split(tree), options.area, options);
|
|
1788
|
+
return lift.panes.has(drawn) || lift.spines.has(drawn);
|
|
1789
|
+
}
|
|
1669
1790
|
function tilingSubjects(tree, options) {
|
|
1670
1791
|
const { ops } = options;
|
|
1671
1792
|
const out = [];
|
|
@@ -1688,11 +1809,10 @@ function propertyTally(properties, limit) {
|
|
|
1688
1809
|
return { counts, failures, checkFor };
|
|
1689
1810
|
}
|
|
1690
1811
|
function tilingConformance(trees, options, limit = 20) {
|
|
1691
|
-
refuseFold(options, "tilingConformance");
|
|
1692
1812
|
const { ops, area } = options;
|
|
1693
1813
|
const { counts, failures, checkFor } = propertyTally(TILING_PROPERTIES, limit);
|
|
1694
1814
|
const norm = (t) => ops.normalize ? ops.normalize(t) : t;
|
|
1695
|
-
const lay2 = (t) => layoutSplitTree(ops.split(t), area, options)
|
|
1815
|
+
const lay2 = (t, order) => layoutSplitTree(ops.split(t), area, withOrder(options, order));
|
|
1696
1816
|
const drawnAs = (t, k) => ops.stackOf?.(t, k)?.active ?? k;
|
|
1697
1817
|
const callbacks = !!(options.fixed || options.fixedAcross || options.floor);
|
|
1698
1818
|
const keysOf = (t) => panesOf(ops.split(t)).flatMap((p) => ops.stackOf?.(t, p)?.members ?? [p]);
|
|
@@ -1701,6 +1821,7 @@ function tilingConformance(trees, options, limit = 20) {
|
|
|
1701
1821
|
for (const tree of trees) {
|
|
1702
1822
|
const snapshot = copy(tree);
|
|
1703
1823
|
for (const subject of tilingSubjects(tree, options)) {
|
|
1824
|
+
if (!liftable(tree, subject, options)) continue;
|
|
1704
1825
|
const check = checkFor(`tree ${n}, ${subject.kind === "pane" ? `pane ${String(subject.pane)}` : `stack ${subject.stack.id}`}`);
|
|
1705
1826
|
const drag = tilingDrag(tree, subject, options);
|
|
1706
1827
|
const key = subject.kind === "pane" ? subject.pane : subject.stack.active;
|
|
@@ -1714,7 +1835,8 @@ function tilingConformance(trees, options, limit = 20) {
|
|
|
1714
1835
|
const home = drag.after({ kind: "home" });
|
|
1715
1836
|
check("home-is-lift", home.tree === tree && sameData(home.layout, drag.lift.layout) && home.refusal === null, () => "after(home) is not the lift tree laid out");
|
|
1716
1837
|
const takes = panesOf(ops.split(drag.base.tree)).length < panesOf(ops.split(tree)).length;
|
|
1717
|
-
|
|
1838
|
+
const gap = takes && subjectLift !== void 0;
|
|
1839
|
+
check("home-is-the-gap", gap ? near(drag.home, subjectLift, EPS) : drag.home === null, () => `home ${JSON.stringify(drag.home)}, the release ${takes ? "takes" : "takes no"} drawn pane${subjectLift ? "" : " (the subject is folded at the lift)"}`);
|
|
1718
1840
|
if (drag.home) {
|
|
1719
1841
|
for (const [pane, r] of drag.base.layout) {
|
|
1720
1842
|
if (overlap(drag.home, r) <= EPS) continue;
|
|
@@ -1726,6 +1848,14 @@ function tilingConformance(trees, options, limit = 20) {
|
|
|
1726
1848
|
held.push({ kind: "swap", at }, ...PANE_SIDES.map((side) => ({ kind: "beside", at, side })));
|
|
1727
1849
|
if (ops.join) held.push({ kind: "join", at }, { kind: "join", at, index: 0 });
|
|
1728
1850
|
}
|
|
1851
|
+
for (const at of new Set(drag.base.folds.flatMap((f) => f.panes))) {
|
|
1852
|
+
const kinds = [{ kind: "swap", at }, ...PANE_SIDES.map((side) => ({ kind: "beside", at, side })), ...ops.join ? [{ kind: "join", at }] : []];
|
|
1853
|
+
for (const h of kinds) {
|
|
1854
|
+
const code = drag.after(h).refusal?.code;
|
|
1855
|
+
const own = h.kind === "swap" && subject.kind === "pane" && !!ops.stackOf && ops.stackOf(tree, subject.pane)?.id === ops.stackOf(tree, at)?.id && !!ops.stackOf(tree, at);
|
|
1856
|
+
check("folded-refused", code === "folded" || own && code === "self", () => `${show(h)}: the base folds ${String(at)}, refused ${code ?? "nothing"}`);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1729
1859
|
for (const h of held) {
|
|
1730
1860
|
const a = drag.after(h);
|
|
1731
1861
|
check("nothing-changes", drag.after(h) === a, () => `${show(h)}: after() gave a new object for the same place`);
|
|
@@ -1743,8 +1873,14 @@ function tilingConformance(trees, options, limit = 20) {
|
|
|
1743
1873
|
continue;
|
|
1744
1874
|
}
|
|
1745
1875
|
const own = drawnAs(a.tree, key);
|
|
1746
|
-
|
|
1747
|
-
|
|
1876
|
+
const again = lay2(a.tree, a.order);
|
|
1877
|
+
const lands = near(a.landing, h.kind === "home" ? a.layout.get(own) ?? a.spines.get(own) : a.layout.get(own), EPS);
|
|
1878
|
+
check(
|
|
1879
|
+
"one-layout",
|
|
1880
|
+
sameData(a.layout, again.panes) && sameData(a.spines, again.spines) && sameData(a.folds, again.folds) && lands,
|
|
1881
|
+
() => `${show(h)}: the layout or the landing is not after().tree's, laid out with after().order`
|
|
1882
|
+
);
|
|
1883
|
+
if (h.kind === "swap" && !callbacks && !options.fold) {
|
|
1748
1884
|
const partner = drawnAs(a.tree, h.at);
|
|
1749
1885
|
const exchanged = near(a.layout.get(partner), subjectLift) && near(a.layout.get(own), liftOf(h.at));
|
|
1750
1886
|
const others = [...a.layout].every(([p, r]) => p === own || p === partner || near(r, liftOf(p)));
|
|
@@ -1809,7 +1945,7 @@ var TILING_HIT_PROPERTIES = [
|
|
|
1809
1945
|
"one-pass",
|
|
1810
1946
|
/** A place on the map is offered exactly when `after(place).refusal` is null (a side the run-neighbor rule removed is neither); over a refused zone nothing is held and the refusal is named. */
|
|
1811
1947
|
"existence",
|
|
1812
|
-
/** Every place whose release gives the lift back reads as home, and its release commits the lift tree. */
|
|
1948
|
+
/** Every place whose release gives the lift back reads as home, and its release commits the lift tree (never for a subject folded at the lift: any drop opens it). */
|
|
1813
1949
|
"lift-equals-home",
|
|
1814
1950
|
/** With no hold: lift basis, the mark contains the pointer and lies inside the target pane as drawn; base basis, the landing contains the pointer for every insert and join (swaps whose landing lies beside the pointer are counted, not failed). */
|
|
1815
1951
|
"shown-under-pointer",
|
|
@@ -1829,7 +1965,18 @@ var TILING_HIT_PROPERTIES = [
|
|
|
1829
1965
|
* pane, every point reads the same place where both are live, and where a place is refused the point falls to the
|
|
1830
1966
|
* target beneath (nothing, or a part's pane body), never to a neighboring zone.
|
|
1831
1967
|
*/
|
|
1832
|
-
"room-free-map"
|
|
1968
|
+
"room-free-map",
|
|
1969
|
+
/**
|
|
1970
|
+
* Under a fold, a rail takes no drop: every point of a rail's box (its edges included) has no place, holds nothing
|
|
1971
|
+
* (whatever was held), and reads `folded` with that rail and the pane painted there (`paintedSpines` at the drag's
|
|
1972
|
+
* rail offsets on the lift basis, none on the base), null in a gap.
|
|
1973
|
+
*/
|
|
1974
|
+
"spine-no-place",
|
|
1975
|
+
/**
|
|
1976
|
+
* Under a fold, on the lift basis, a pane the lift draws open and the base folds (the named case) is a target, and
|
|
1977
|
+
* every place on it is refused `folded`: the pointer over it holds nothing and names the refused place.
|
|
1978
|
+
*/
|
|
1979
|
+
"named-case-refused"
|
|
1833
1980
|
];
|
|
1834
1981
|
function seeded(seed) {
|
|
1835
1982
|
let s = seed >>> 0 || 1;
|
|
@@ -1844,14 +1991,13 @@ function seeded(seed) {
|
|
|
1844
1991
|
var inside2 = (r, p) => contains(r, p, 0);
|
|
1845
1992
|
var within = (a, b, e = 1e-6) => a.x >= b.x - e && a.y >= b.y - e && a.x + a.width <= b.x + b.width + e && a.y + a.height <= b.y + b.height + e;
|
|
1846
1993
|
var sameRect2 = (a, b, e = 1e-3) => !!a && !!b && Math.abs(a.x - b.x) <= e && Math.abs(a.y - b.y) <= e && Math.abs(a.width - b.width) <= e && Math.abs(a.height - b.height) <= e;
|
|
1847
|
-
var show2 = (h) => h === null ? "nothing" :
|
|
1994
|
+
var show2 = (h) => h === null ? "nothing" : showHeld(h);
|
|
1848
1995
|
var cross = (a, b, p) => (b.x - a.x) * (p.y - a.y) - (b.y - a.y) * (p.x - a.x);
|
|
1849
1996
|
function inQuad(q, p) {
|
|
1850
1997
|
const s = q.map((a, i) => cross(a, q[(i + 1) % q.length], p));
|
|
1851
1998
|
return s.every((v) => v > 1e-9) || s.every((v) => v < -1e-9);
|
|
1852
1999
|
}
|
|
1853
2000
|
function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
1854
|
-
refuseFold(options, "tilingHitConformance");
|
|
1855
2001
|
const { ops, area } = options;
|
|
1856
2002
|
const { counts, failures, checkFor } = propertyTally(TILING_HIT_PROPERTIES, limit);
|
|
1857
2003
|
const reported = { swapsBeside: 0, insertsMoveOthers: 0, insertsMoveOthersBeside: 0 };
|
|
@@ -1867,6 +2013,7 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
|
1867
2013
|
let n = 0;
|
|
1868
2014
|
for (const tree of trees) {
|
|
1869
2015
|
for (const subject of tilingSubjects(tree, options)) {
|
|
2016
|
+
if (!liftable(tree, subject, options)) continue;
|
|
1870
2017
|
const drag = tilingDrag(tree, subject, options);
|
|
1871
2018
|
const name = `tree ${n}, ${subject.kind === "pane" ? `pane ${String(subject.pane)}` : `stack ${subject.stack.id}`}`;
|
|
1872
2019
|
for (const basis of ["lift", "base"]) {
|
|
@@ -1913,17 +2060,20 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
|
1913
2060
|
const targetsAtLift = hit.targets;
|
|
1914
2061
|
const snapshot = JSON.stringify(hit.targets);
|
|
1915
2062
|
const subjectDrawn = drawnAs(drag.lift.tree, subjectKey);
|
|
2063
|
+
const baseFolded = new Set(drag.base.folds.flatMap((f) => f.panes));
|
|
2064
|
+
const rails = laid.folds.map((f, i) => ({ f, i })).filter(({ f, i }) => f.railOf === i);
|
|
2065
|
+
const railOf = (p) => rails.find(({ f }) => inside2(f.rail, p))?.i ?? null;
|
|
1916
2066
|
const atOf = (pane) => {
|
|
1917
|
-
if (drag.base.layout.has(pane)) return pane;
|
|
2067
|
+
if (drag.base.layout.has(pane) || baseFolded.has(pane)) return pane;
|
|
1918
2068
|
for (const m of stackOf(laid.tree, pane)?.members ?? []) {
|
|
1919
2069
|
if (inSubject(m)) continue;
|
|
1920
2070
|
const d = drawnAs(drag.base.tree, m);
|
|
1921
|
-
if (drag.base.layout.has(d)) return d;
|
|
2071
|
+
if (drag.base.layout.has(d) || baseFolded.has(d)) return d;
|
|
1922
2072
|
}
|
|
1923
2073
|
return null;
|
|
1924
2074
|
};
|
|
1925
2075
|
const flatOf = (t) => {
|
|
1926
|
-
const placed = layoutSplitTree(ops.split(t), area, options).panes;
|
|
2076
|
+
const placed = layoutSplitTree(ops.split(t), area, withOrder(options, laid.order)).panes;
|
|
1927
2077
|
const keysIn = (n2) => "pane" in n2 ? [n2.pane] : [...keysIn(n2.a), ...keysIn(n2.b)];
|
|
1928
2078
|
const box = (n2) => {
|
|
1929
2079
|
const rs = keysIn(n2).map((k) => placed.get(k)).filter((r) => !!r);
|
|
@@ -2030,12 +2180,15 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
|
2030
2180
|
return { x: c.cr, y: r.y, width: r.x + r.width - c.cr, height: r.height };
|
|
2031
2181
|
};
|
|
2032
2182
|
const live = (h) => h.kind === "home" || drag.after(h).refusal === null;
|
|
2183
|
+
const carriedIn = drag.lift.spines.has(subjectDrawn);
|
|
2033
2184
|
const givesLift = (h) => {
|
|
2034
2185
|
if (h.kind === "home") return true;
|
|
2186
|
+
if (carriedIn) return false;
|
|
2035
2187
|
const a = drag.after(h);
|
|
2036
2188
|
return !a.refusal && (a.tree === drag.lift.tree || flatOf(a.tree) === liftFlat);
|
|
2037
2189
|
};
|
|
2038
2190
|
const expectAt = (p) => {
|
|
2191
|
+
if (railOf(p) !== null) return { raw: null, refused: null, box: null, pane: null, tie: false };
|
|
2039
2192
|
if (home && inside2(home, p)) return { raw: HOME2, refused: null, box: home, pane: null, tie: false };
|
|
2040
2193
|
const pane = panes.find((x) => inside2(x.rect, p));
|
|
2041
2194
|
if (!pane) return { raw: null, refused: null, box: null, pane: null, tie: false };
|
|
@@ -2103,7 +2256,7 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
|
2103
2256
|
const own = drawnAs(a.tree, subjectKey);
|
|
2104
2257
|
const others = [...a.layout].some(([k, rect]) => k !== at && k !== own && drag.base.layout.has(k) && !sameRect2(rect, drag.base.layout.get(k)));
|
|
2105
2258
|
const under = !!a.landing && inside2(a.landing, p);
|
|
2106
|
-
if (others || options.fixed || options.fixedAcross || hasMaster) {
|
|
2259
|
+
if (others || options.fixed || options.fixedAcross || hasMaster || options.fold) {
|
|
2107
2260
|
reported.insertsMoveOthers++;
|
|
2108
2261
|
if (!under) reported.insertsMoveOthersBeside++;
|
|
2109
2262
|
} else check("shown-under-pointer", under, () => `${show2(r.held)}: landing ${JSON.stringify(a.landing)} does not contain ${p.x.toFixed(1)},${p.y.toFixed(1)}`);
|
|
@@ -2207,7 +2360,8 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
|
2207
2360
|
if (zoneOf(z) !== want || !inside2(e.box, z)) continue;
|
|
2208
2361
|
const ang = rnd() * Math.PI * 2;
|
|
2209
2362
|
const len = Math.sqrt(rnd()) * 0.9;
|
|
2210
|
-
|
|
2363
|
+
const p = { x: z.x + Math.cos(ang) * ex * len, y: z.y + Math.sin(ang) * ey * len };
|
|
2364
|
+
if (railOf(p) === null) path.push(p);
|
|
2211
2365
|
}
|
|
2212
2366
|
const tb = hit.heldOf(start.place)?.kind === "join" ? null : box;
|
|
2213
2367
|
if (tb) {
|
|
@@ -2217,7 +2371,7 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
|
2217
2371
|
const ang = rnd() * Math.PI * 2;
|
|
2218
2372
|
const len = Math.sqrt(rnd()) * 0.9;
|
|
2219
2373
|
const p = { x: a.x + Math.cos(ang) * rx * len, y: a.y + Math.sin(ang) * ry * len };
|
|
2220
|
-
if (inside2(e.pane.rect, p) && !(home && inside2(home, p))) path.push(p);
|
|
2374
|
+
if (inside2(e.pane.rect, p) && !(home && inside2(home, p)) && railOf(p) === null) path.push(p);
|
|
2221
2375
|
}
|
|
2222
2376
|
}
|
|
2223
2377
|
let state = start;
|
|
@@ -2252,6 +2406,52 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
|
|
|
2252
2406
|
if (probed++ >= 24) break;
|
|
2253
2407
|
check("hold-measures", shows(p, taken.place), () => `${taken.place} taken at ${q.x.toFixed(1)},${q.y.toFixed(1)} is kept at ${p.x.toFixed(1)},${p.y.toFixed(1)}, past both measures (the map reads ${hit.placeAt(p)})`);
|
|
2254
2408
|
}
|
|
2409
|
+
if (rails.length > 0) {
|
|
2410
|
+
const painted = paintedSpines(laid, basis === "lift" ? options.railOffset : void 0);
|
|
2411
|
+
const taken = samples.map((p) => hit.hold(null, p)).find((s) => s !== null) ?? null;
|
|
2412
|
+
for (const { f, i } of rails) {
|
|
2413
|
+
const r = f.rail;
|
|
2414
|
+
const points = [
|
|
2415
|
+
{ x: r.x, y: r.y },
|
|
2416
|
+
{ x: r.x + r.width, y: r.y + r.height },
|
|
2417
|
+
{ x: r.x + r.width / 2, y: r.y },
|
|
2418
|
+
{ x: r.x, y: r.y + r.height / 2 }
|
|
2419
|
+
];
|
|
2420
|
+
for (let k = 0; k < 16; k++) points.push(randomPoint(r));
|
|
2421
|
+
for (const p of points) {
|
|
2422
|
+
const want = [...painted].find(([pane, s]) => laid.folds.some((g) => g.railOf === i && g.panes.includes(pane)) && inside2(s, p))?.[0] ?? null;
|
|
2423
|
+
const read = fresh(p);
|
|
2424
|
+
const at = hit.foldedAt(p);
|
|
2425
|
+
check(
|
|
2426
|
+
"spine-no-place",
|
|
2427
|
+
hit.placeAt(p) === null && hit.hold(null, p) === null && hit.hold(taken, p) === null && read.held === null && read.refused === null,
|
|
2428
|
+
() => `rail ${i} at ${p.x.toFixed(1)},${p.y.toFixed(1)}: place ${hit.placeAt(p)}, held ${show2(read.held)}, refused ${show2(read.refused)}`
|
|
2429
|
+
);
|
|
2430
|
+
check(
|
|
2431
|
+
"spine-no-place",
|
|
2432
|
+
read.folded?.rail === i && read.folded.pane === want && at?.rail === i && at.pane === want,
|
|
2433
|
+
() => `rail ${i} at ${p.x.toFixed(1)},${p.y.toFixed(1)}: reads ${JSON.stringify(read.folded)}, foldedAt ${JSON.stringify(at)}, painted ${String(want)}`
|
|
2434
|
+
);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
if (basis === "lift") {
|
|
2439
|
+
for (const [pane, r] of drag.lift.layout) {
|
|
2440
|
+
const at = atOf(pane);
|
|
2441
|
+
if (at === null || !baseFolded.has(at)) continue;
|
|
2442
|
+
const target = hit.targets.find((t) => !t.part && !t.home && t.pane === pane);
|
|
2443
|
+
const torn = !!stackOf(drag.lift.tree, at) && stackOf(drag.lift.tree, at)?.id === stackOf(drag.lift.tree, subjectKey)?.id;
|
|
2444
|
+
const places2 = [...torn ? [] : [{ kind: "swap", at }], ...["top", "right", "bottom", "left"].map((side) => ({ kind: "beside", at, side }))];
|
|
2445
|
+
const codes = places2.map((h) => drag.after(h).refusal?.code);
|
|
2446
|
+
const c = { x: r.x + r.width / 2, y: r.y + r.height / 2 };
|
|
2447
|
+
const read = fresh(c);
|
|
2448
|
+
check(
|
|
2449
|
+
"named-case-refused",
|
|
2450
|
+
target?.at === at && codes.every((code) => code === "folded") && hit.placeAt(c) === null && read.held === null && read.refused !== null,
|
|
2451
|
+
() => `${String(pane)}, open at the lift and folded in the base as ${String(at)}: target ${target ? String(target.at) : "none"}, refusals ${codes.join(",")}, place ${hit.placeAt(c)}, refused ${show2(read.refused)}`
|
|
2452
|
+
);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2255
2455
|
check("fixed-map", hit.targets === targetsAtLift && Object.isFrozen(hit.targets) && JSON.stringify(hit.targets) === snapshot, () => "the targets changed during the drag");
|
|
2256
2456
|
const zonesAfter = samples.map((p) => hit.placeAt(p));
|
|
2257
2457
|
const moved = zonesAfter.findIndex((z, i) => z !== zonesBefore[i]);
|
|
@@ -2321,6 +2521,7 @@ export {
|
|
|
2321
2521
|
masterStack,
|
|
2322
2522
|
neighbor,
|
|
2323
2523
|
orderTargets,
|
|
2524
|
+
paintedSpines,
|
|
2324
2525
|
paneCenter,
|
|
2325
2526
|
paneRegion,
|
|
2326
2527
|
paneRegionShapes,
|