@n-uf/placement 26.11.49 → 26.11.51
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 +87 -0
- package/dist/{chunk-FJ5R6PMB.js → chunk-UPZXNTIR.js} +358 -88
- package/dist/chunk-UPZXNTIR.js.map +1 -0
- package/dist/{lanes-D8K4UI3s.d.ts → lanes-Dl39s0r7.d.ts} +69 -9
- package/dist/scene-cases.d.ts +18 -2
- package/dist/scene-cases.js +65 -5
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +2 -2
- package/dist/scene.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-FJ5R6PMB.js.map +0 -1
|
@@ -1376,12 +1376,42 @@ function lift(scene, id) {
|
|
|
1376
1376
|
const inEdge = scene.edges.some((e) => e.items.includes(id));
|
|
1377
1377
|
const inFloat = scene.floats.some((f) => f.id === id);
|
|
1378
1378
|
if (!inEdge && !inFloat) return scene;
|
|
1379
|
+
let s = scene;
|
|
1380
|
+
const from = scene.edges.find((e) => e.items.includes(id));
|
|
1381
|
+
const owner = from ? roomOwner(scene, from, from.items.indexOf(id)) : void 0;
|
|
1382
|
+
if (from && owner) {
|
|
1383
|
+
const length = lengthOn(scene, from, id);
|
|
1384
|
+
if (length > 0) s = withSpace(s, owner, (scene.items[owner].space ?? 0) + (scene.items[id]?.space ?? 0) + length + nonNegative(from.gap));
|
|
1385
|
+
}
|
|
1379
1386
|
return prune({
|
|
1380
|
-
...
|
|
1381
|
-
edges: inEdge ?
|
|
1382
|
-
floats: inFloat ?
|
|
1387
|
+
...s,
|
|
1388
|
+
edges: inEdge ? s.edges.map((e) => e.items.includes(id) ? { ...e, items: e.items.filter((x) => x !== id) } : e) : s.edges,
|
|
1389
|
+
floats: inFloat ? s.floats.filter((f) => f.id !== id) : s.floats
|
|
1383
1390
|
});
|
|
1384
1391
|
}
|
|
1392
|
+
function roomOwner(scene, edge, k) {
|
|
1393
|
+
const id = edge.items[k];
|
|
1394
|
+
if (id === void 0) return void 0;
|
|
1395
|
+
const zone = zoneAt(scene, edge, id);
|
|
1396
|
+
if (zone === "center") return void 0;
|
|
1397
|
+
const step = zone === "start" ? 1 : -1;
|
|
1398
|
+
for (let j = k + step; j >= 0 && j < edge.items.length; j += step) {
|
|
1399
|
+
const nb = edge.items[j];
|
|
1400
|
+
if (zoneAt(scene, edge, nb) !== zone || scene.items[nb]?.closed) continue;
|
|
1401
|
+
if ((scene.items[nb]?.space ?? 0) > 0) return nb;
|
|
1402
|
+
}
|
|
1403
|
+
return void 0;
|
|
1404
|
+
}
|
|
1405
|
+
function lengthOn(scene, edge, id) {
|
|
1406
|
+
const it = solve(scene).items[id];
|
|
1407
|
+
if (!it || it.inMenu || it.edge !== edge.id) return 0;
|
|
1408
|
+
return axisOf(edge.side) === "column" ? it.rect.height : it.rect.width;
|
|
1409
|
+
}
|
|
1410
|
+
var nonNegative = (n) => Number.isFinite(n) && n > 0 ? n : 0;
|
|
1411
|
+
function withSpace(scene, id, space) {
|
|
1412
|
+
const { space: _old, ...bare } = scene.items[id];
|
|
1413
|
+
return { ...scene, items: { ...scene.items, [id]: space > 1e-6 ? { ...bare, space } : bare } };
|
|
1414
|
+
}
|
|
1385
1415
|
function newColumn(scene, side, kind, ring, items, others) {
|
|
1386
1416
|
const t = scene.columns?.[side];
|
|
1387
1417
|
if (!t || !t.accepts.includes(kind)) return null;
|
|
@@ -1463,13 +1493,14 @@ function moveAmong(scene, id, place, others) {
|
|
|
1463
1493
|
const target = lifted.edges.find((e) => e.id === place.edge);
|
|
1464
1494
|
if (!target) return scene;
|
|
1465
1495
|
const k = insertIndex(lifted, target, zone, place.at);
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1496
|
+
const into = { ...target, items: [...target.items.slice(0, k), id, ...target.items.slice(k)] };
|
|
1497
|
+
const placed = { ...lifted, edges: lifted.edges.map((e) => e === target ? into : e) };
|
|
1498
|
+
const owner = roomOwner(placed, into, k);
|
|
1499
|
+
if (!owner) return placed;
|
|
1500
|
+
const length = lengthOn(placed, into, id);
|
|
1501
|
+
if (length <= 0) return placed;
|
|
1502
|
+
const room = placed.items[owner].space ?? 0;
|
|
1503
|
+
return withSpace(placed, owner, room - (placed.items[id].space ?? 0) - length - nonNegative(into.gap));
|
|
1473
1504
|
}
|
|
1474
1505
|
function nextSince(scene) {
|
|
1475
1506
|
const most = scene.floats.reduce((m, f) => Math.max(m, isSince(f.since) ? f.since : 0), 0);
|
|
@@ -1486,7 +1517,7 @@ function floatAt(scene, id, at, orient2) {
|
|
|
1486
1517
|
const float = at ? { id, rect: { x: at.x, y: at.y, width: at.width, height: at.height }, ...o ? { orient: o } : {}, ...seq } : { id, rect: { x: 0, y: 0, width: size.width, height: size.height }, anchor: "content-top-right", ...o ? { orient: o } : {}, ...seq };
|
|
1487
1518
|
const { space: _space, ...unspaced } = item;
|
|
1488
1519
|
const next = at && at.width > 0 && at.height > 0 ? { ...unspaced, floatSize: { width: at.width, height: at.height } } : unspaced;
|
|
1489
|
-
const lifted = lift(
|
|
1520
|
+
const lifted = withItem(lift(scene, id), next);
|
|
1490
1521
|
return { ...lifted, floats: [...lifted.floats, float] };
|
|
1491
1522
|
}
|
|
1492
1523
|
function canFold(scene, id) {
|
|
@@ -3274,6 +3305,8 @@ function orderedStops(scene, dragged, options) {
|
|
|
3274
3305
|
|
|
3275
3306
|
// src/scene/lanes.ts
|
|
3276
3307
|
var SPOT_PITCH = 40;
|
|
3308
|
+
var SNAP_DISTANCE = 8;
|
|
3309
|
+
var STEP = 1;
|
|
3277
3310
|
var mid = (r, axis) => axis === "x" ? r.x + r.width / 2 : r.y + r.height / 2;
|
|
3278
3311
|
var lo = (r, axis) => axis === "x" ? r.x : r.y;
|
|
3279
3312
|
var len = (r, axis) => axis === "x" ? r.width : r.height;
|
|
@@ -3294,6 +3327,17 @@ function neighbors(after, edge, dragged, axis) {
|
|
|
3294
3327
|
const at = me ? mid(me.rect, axis) : 0;
|
|
3295
3328
|
return { before: [...others].reverse().find((o) => mid(o.r, axis) < at)?.id ?? "^", next: others.find((o) => mid(o.r, axis) >= at)?.id ?? "$" };
|
|
3296
3329
|
}
|
|
3330
|
+
function givesWay(now, after, lane, side, extent) {
|
|
3331
|
+
if (!now) return null;
|
|
3332
|
+
if (!after || after.inMenu || after.floating || after.edge !== lane) return "leaves";
|
|
3333
|
+
const [p0, p1] = extent(now.rect);
|
|
3334
|
+
const [q0, q1] = extent(after.rect);
|
|
3335
|
+
if (after.form !== now.form && q1 - q0 < p1 - p0 - 0.5) return "steps";
|
|
3336
|
+
return (side === "before" ? p1 - q1 : q0 - p0) > 0.5 ? "moves" : null;
|
|
3337
|
+
}
|
|
3338
|
+
function liftedLayout(scene, dragged, options) {
|
|
3339
|
+
return solve(lift(scene, dragged), options.previous ? { previous: options.previous } : {});
|
|
3340
|
+
}
|
|
3297
3341
|
function othersKey(layout, dragged) {
|
|
3298
3342
|
return Object.keys(layout.items).filter((id) => id !== dragged).sort().map((id) => {
|
|
3299
3343
|
const it = layout.items[id];
|
|
@@ -3326,7 +3370,7 @@ function lanes(scene, dragged, options = {}) {
|
|
|
3326
3370
|
const rebuilt = base.lanes.map((l) => {
|
|
3327
3371
|
const raws = base.raws.get(l.id);
|
|
3328
3372
|
if (!raws) return l;
|
|
3329
|
-
const again = laneFrom(l.id, raws, held.layout, base.seen, dragged, base.refusals, base.halves.has(l.id), base.share, base.marking, l.id === heldLane);
|
|
3373
|
+
const again = laneFrom(l.id, raws, held.layout, base.seen, dragged, base.refusals, base.halves.has(l.id), base.share, base.marking, l.id === heldLane && !held.slide, true);
|
|
3330
3374
|
if (!again) return l;
|
|
3331
3375
|
return l.id === heldLane ? again : { ...l, marks: again.marks };
|
|
3332
3376
|
});
|
|
@@ -3366,7 +3410,13 @@ function build(scene, dragged, options) {
|
|
|
3366
3410
|
raws.push({ lane, edge: null, axis: "y", id: `${lane}/${p.kind === "rail" ? "end" : "line"}`, before: "^", next: "$", landing, layout, target: t, hit: strip ?? t.hit, ...strip ? { strip: true } : {} });
|
|
3367
3411
|
}
|
|
3368
3412
|
}
|
|
3369
|
-
|
|
3413
|
+
const lifted = liftedLayout(scene, dragged, options);
|
|
3414
|
+
if (options.stretchPositions !== "pitched") {
|
|
3415
|
+
const { spots, absorbed } = slidingSpots(scene, dragged, options, seen, lifted, raws, pitch > 0 ? pitch : SPOT_PITCH);
|
|
3416
|
+
for (let i = raws.length - 1; i >= 0; i--) if (absorbed.has(raws[i])) raws.splice(i, 1);
|
|
3417
|
+
raws.push(...spots);
|
|
3418
|
+
} else if (pitch > 0) raws.push(...pitchedSpots(scene, dragged, options, seen, lifted, raws, pitch));
|
|
3419
|
+
raws.push(...takeoverSpots(scene, dragged, options, seen, lifted, raws, pitch > 0 ? pitch : SPOT_PITCH));
|
|
3370
3420
|
const byLane = /* @__PURE__ */ new Map();
|
|
3371
3421
|
for (const r of raws) byLane.set(r.lane, [...byLane.get(r.lane) ?? [], r]);
|
|
3372
3422
|
const halves = new Set(scene.edges.filter((e) => (e.side === "left" || e.side === "right") && !e.compact).map((e) => e.id));
|
|
@@ -3376,7 +3426,8 @@ function build(scene, dragged, options) {
|
|
|
3376
3426
|
const main = scene.items[id]?.forms[axis === "x" ? "row" : "column"]?.[0]?.main;
|
|
3377
3427
|
return main?.grows ? main.natural : void 0;
|
|
3378
3428
|
},
|
|
3379
|
-
gap: (edge) => nonNeg(scene.edges.find((e) => e.id === edge)?.gap)
|
|
3429
|
+
gap: (edge) => nonNeg(scene.edges.find((e) => e.id === edge)?.gap),
|
|
3430
|
+
lifted
|
|
3380
3431
|
};
|
|
3381
3432
|
const shareOf = (g, size) => g === void 0 || !Number.isFinite(g) || size <= EPS ? 0.5 : clamp(g / size, 0, 1);
|
|
3382
3433
|
const w = own?.rect.width ?? 0;
|
|
@@ -3414,7 +3465,7 @@ function build(scene, dragged, options) {
|
|
|
3414
3465
|
}
|
|
3415
3466
|
};
|
|
3416
3467
|
}
|
|
3417
|
-
function laneFrom(id, list, drawn, seen, dragged, rs, halves, share, marking, heldHere = false) {
|
|
3468
|
+
function laneFrom(id, list, drawn, seen, dragged, rs, halves, share, marking, heldHere = false, spotHeld = false) {
|
|
3418
3469
|
if (list.length === 0) return null;
|
|
3419
3470
|
const first = list[0];
|
|
3420
3471
|
const axis = first.axis;
|
|
@@ -3425,10 +3476,18 @@ function laneFrom(id, list, drawn, seen, dragged, rs, halves, share, marking, he
|
|
|
3425
3476
|
else if (edgeLayout) laneRect = axis === "x" ? rect(edgeLayout.rect.x, band.y, edgeLayout.rect.width, band.height) : rect(band.x, edgeLayout.rect.y, band.width, edgeLayout.rect.height);
|
|
3426
3477
|
else if (list.every((r) => r.strip)) laneRect = list.map((r) => r.hit).reduce(hull2);
|
|
3427
3478
|
else laneRect = list.map((r) => r.hit).reduce(hull2, band);
|
|
3428
|
-
const
|
|
3479
|
+
const firstOf = (r) => r.slide?.first ?? r.landing;
|
|
3480
|
+
const lastOf = (r) => r.slide?.last ?? r.landing;
|
|
3481
|
+
const sorted = [...list].sort((a, b) => mid(firstOf(a), axis) - mid(firstOf(b), axis) || (a.home ? -1 : b.home ? 1 : 0));
|
|
3429
3482
|
const homeAt = halves ? void 0 : list.find((r) => r.home)?.landing;
|
|
3430
|
-
const nearHome = (r) => !!homeAt && !r.home && Math.abs(lo(r.landing, axis) - lo(homeAt, axis)) < Math.max(0, marking.pitch) / 2;
|
|
3431
|
-
const unique =
|
|
3483
|
+
const nearHome = (r) => !!homeAt && !r.home && !r.slide && Math.abs(lo(r.landing, axis) - lo(homeAt, axis)) < Math.max(0, marking.pitch) / 2;
|
|
3484
|
+
const unique = [];
|
|
3485
|
+
for (const x of sorted) {
|
|
3486
|
+
if (nearHome(x)) continue;
|
|
3487
|
+
const k = unique.findIndex((y) => !x.slide && !y.slide && sameRect(y.landing, x.landing) || y.id === x.id);
|
|
3488
|
+
if (k < 0) unique.push(x);
|
|
3489
|
+
else if (x.home && !unique[k].home && !unique.some((y) => y.id === x.id && y !== unique[k])) unique[k] = x;
|
|
3490
|
+
}
|
|
3432
3491
|
const start = lo(laneRect, axis);
|
|
3433
3492
|
const end = start + len(laneRect, axis);
|
|
3434
3493
|
const drawnItems = first.edge && halves ? new Map(onEdge(drawn, first.edge, dragged, axis).map((o) => [o.id, o.r])) : /* @__PURE__ */ new Map();
|
|
@@ -3438,11 +3497,13 @@ function laneFrom(id, list, drawn, seen, dragged, rs, halves, share, marking, he
|
|
|
3438
3497
|
const a = unique[i];
|
|
3439
3498
|
const b = unique[i + 1];
|
|
3440
3499
|
const shared = a.next === b.before && a.next !== "$" ? drawnItems.get(a.next) : void 0;
|
|
3441
|
-
const
|
|
3442
|
-
const
|
|
3443
|
-
const
|
|
3500
|
+
const aLanding = lastOf(a);
|
|
3501
|
+
const bLanding = firstOf(b);
|
|
3502
|
+
const aEnd = lo(aLanding, axis) + len(aLanding, axis);
|
|
3503
|
+
const across2 = (aEnd + lo(bLanding, axis)) / 2;
|
|
3504
|
+
const overlap = lo(bLanding, axis) < aEnd - EPS;
|
|
3444
3505
|
const slack = Math.max(0, marking.pitch) / 2;
|
|
3445
|
-
const atGrab = clamp(across2 + (held - 0.5) * (len(
|
|
3506
|
+
const atGrab = clamp(across2 + (held - 0.5) * (len(aLanding, axis) + len(bLanding, axis)) / 2, lo(bLanding, axis) - slack, aEnd + slack);
|
|
3446
3507
|
const raw = shared ? mid(shared, axis) : overlap ? atGrab : across2;
|
|
3447
3508
|
cuts.push(clamp(Math.max(raw, cuts[i - 1] ?? start), start, end));
|
|
3448
3509
|
}
|
|
@@ -3453,6 +3514,7 @@ function laneFrom(id, list, drawn, seen, dragged, rs, halves, share, marking, he
|
|
|
3453
3514
|
target: x.target,
|
|
3454
3515
|
...x.home ? { home: true } : {},
|
|
3455
3516
|
...x.pitched ? { pitched: true } : {},
|
|
3517
|
+
...x.slide ? { slide: { from: x.slide.from, to: x.slide.to, snaps: x.slide.snaps, snapDistance: x.slide.snapDistance, step: x.slide.step } } : {},
|
|
3456
3518
|
others: othersKey(x.layout, dragged)
|
|
3457
3519
|
}));
|
|
3458
3520
|
const itemLen = Math.min(...unique.map((x) => len(x.landing, axis)));
|
|
@@ -3476,7 +3538,9 @@ function laneFrom(id, list, drawn, seen, dragged, rs, halves, share, marking, he
|
|
|
3476
3538
|
besideMin: halves || marking.pitch <= 0 ? itemLen : marking.pitch,
|
|
3477
3539
|
gap: marking.gap(first.edge),
|
|
3478
3540
|
landingOf: (pair) => landings.get(pair),
|
|
3479
|
-
|
|
3541
|
+
// Judged against the layout the marks are drawn in; with a spot held, against the layout as seen with the held
|
|
3542
|
+
// item lifted (in the spot's own a neighbor has already stepped down or moved).
|
|
3543
|
+
givesWay: (iid, side, after) => givesWay((spotHeld ? marking.lifted : drawn).items[iid], after.items[iid], id, side, (r) => extent(iid, r))
|
|
3480
3544
|
}) : virtualMarks(id, unique, drawn.items[dragged]);
|
|
3481
3545
|
return { id, rect: laneRect, axis, spots, refused, marks, ...list.every((r) => r.strip) ? { owns: true } : {} };
|
|
3482
3546
|
}
|
|
@@ -3487,6 +3551,10 @@ var HATCH_END = 8;
|
|
|
3487
3551
|
var HATCH_EDGE = 8;
|
|
3488
3552
|
function edgeMarks(lane, laneRect, axis, items, refused, itemLen, lands, held, more) {
|
|
3489
3553
|
const { besideMin } = more;
|
|
3554
|
+
const hatches = (pair, a, b, p, q, gl, gr) => {
|
|
3555
|
+
if (gl && Math.abs(p - a) < EPS) out.push({ id: `${lane}/hatch/${pair}:before`, kind: "hatch", rect: along(laneRect, axis, p, p + Math.min(HATCH_END, (q - p) / 2)), givesWay: gl });
|
|
3556
|
+
if (gr && Math.abs(q - b) < EPS) out.push({ id: `${lane}/hatch/${pair}:after`, kind: "hatch", rect: along(laneRect, axis, q - Math.min(HATCH_END, (q - p) / 2), q), givesWay: gr });
|
|
3557
|
+
};
|
|
3490
3558
|
const heldAt = items.find((o) => o.id === held);
|
|
3491
3559
|
const heldSpan = heldAt ? [lo(heldAt.r, axis), lo(heldAt.r, axis) + len(heldAt.r, axis)] : null;
|
|
3492
3560
|
const out = [];
|
|
@@ -3504,33 +3572,18 @@ function edgeMarks(lane, laneRect, axis, items, refused, itemLen, lands, held, m
|
|
|
3504
3572
|
const named = `${left}|${right}`;
|
|
3505
3573
|
const beside = ends[i + 1].id === held ? "before" : ends[i].id === held ? "after" : null;
|
|
3506
3574
|
const min = beside ? Math.min(itemLen, besideMin) : itemLen;
|
|
3575
|
+
const spot = !beside && named === pair && items.length > 0 && !isRefused2((a + b) / 2) ? more.landingOf(pair) : void 0;
|
|
3576
|
+
const gl = spot && left !== "^" && more.givesWay(left, "before", spot.layout) ? left : null;
|
|
3577
|
+
const gr = spot && right !== "$" && more.givesWay(right, "after", spot.layout) ? right : null;
|
|
3507
3578
|
if (b - a < min - EPS) {
|
|
3508
|
-
|
|
3509
|
-
if (spot) {
|
|
3510
|
-
const own = (iid) => {
|
|
3511
|
-
const it = spot.layout.items[iid];
|
|
3512
|
-
return it && !it.inMenu && !it.floating && it.edge === lane ? more.extent(iid, it.rect) : null;
|
|
3513
|
-
};
|
|
3514
|
-
let gl = left !== "^" && (() => {
|
|
3515
|
-
const o = own(left);
|
|
3516
|
-
return !o || a - o[1] > 0.5;
|
|
3517
|
-
})();
|
|
3518
|
-
let gr = right !== "$" && (() => {
|
|
3519
|
-
const o = own(right);
|
|
3520
|
-
return !o || o[0] - b > 0.5;
|
|
3521
|
-
})();
|
|
3522
|
-
if (!gl && !gr) {
|
|
3523
|
-
if (right !== "$") gr = true;
|
|
3524
|
-
else if (left !== "^") gl = true;
|
|
3525
|
-
}
|
|
3579
|
+
if (spot && b - a >= besideMin - EPS) {
|
|
3526
3580
|
let ps = [[a, b]];
|
|
3527
3581
|
for (const f of refused) ps = ps.flatMap(([p, q]) => [[p, Math.min(q, f.along[0])], [Math.max(p, f.along[1]), q]]);
|
|
3528
3582
|
if (heldSpan) ps = ps.flatMap(([p, q]) => [[p, Math.min(q, heldSpan[0])], [Math.max(p, heldSpan[1]), q]]);
|
|
3529
3583
|
ps = ps.filter(([p, q]) => q - p >= MIN_BOX - EPS);
|
|
3530
3584
|
ps.forEach(([p, q], k2) => {
|
|
3531
3585
|
out.push({ id: `${lane}/box/${pair}${k2 ? `#${k2}` : ""}`, kind: "box", rect: along(laneRect, axis, p, q) });
|
|
3532
|
-
|
|
3533
|
-
if (gr && Math.abs(q - b) < EPS) out.push({ id: `${lane}/hatch/${pair}:after`, kind: "hatch", rect: along(laneRect, axis, q - Math.min(HATCH_END, (q - p) / 2), q) });
|
|
3586
|
+
hatches(pair, a, b, p, q, gl, gr);
|
|
3534
3587
|
});
|
|
3535
3588
|
if (ps.length > 0) continue;
|
|
3536
3589
|
}
|
|
@@ -3545,6 +3598,7 @@ function edgeMarks(lane, laneRect, axis, items, refused, itemLen, lands, held, m
|
|
|
3545
3598
|
if (q - p < min - EPS) continue;
|
|
3546
3599
|
const base = `${lane}/box/${named}${beside ? `:${beside}` : ""}${k++ ? `#${k - 1}` : ""}`;
|
|
3547
3600
|
out.push({ id: out.some((m) => m.id === base) ? `${base}~2` : base, kind: "box", rect: along(laneRect, axis, p, q) });
|
|
3601
|
+
hatches(pair, a, b, p, q, gl, gr);
|
|
3548
3602
|
}
|
|
3549
3603
|
}
|
|
3550
3604
|
return out;
|
|
@@ -3618,70 +3672,286 @@ function settle(l, drawn, scene, dragged, all, emptyLanes = "real") {
|
|
|
3618
3672
|
return { ...l, marks };
|
|
3619
3673
|
}
|
|
3620
3674
|
var overlaps3 = (a, b) => a.x < b.x + b.width - EPS && b.x < a.x + a.width - EPS && a.y < b.y + b.height - EPS && b.y < a.y + a.height - EPS;
|
|
3621
|
-
function pitchedSpots(scene, dragged, options, seen, raws, pitch) {
|
|
3675
|
+
function pitchedSpots(scene, dragged, options, seen, lifted, raws, pitch) {
|
|
3622
3676
|
const out = [];
|
|
3623
|
-
|
|
3677
|
+
stretches(scene, dragged, options, seen, lifted, raws, (run) => {
|
|
3678
|
+
const { e, axis, gap, middle } = run;
|
|
3679
|
+
const taken = run.mine.map((r) => r.landing);
|
|
3680
|
+
const emit3 = (zone, at, space, x0, flush) => {
|
|
3681
|
+
const hit = landsAt(scene, dragged, run, { edge: e.id, zone, at, space }, x0);
|
|
3682
|
+
if (!hit) return false;
|
|
3683
|
+
const { next, layout } = hit;
|
|
3684
|
+
const landed = layout.items[dragged];
|
|
3685
|
+
const nb = flush !== void 0 ? layout.items[flush] : void 0;
|
|
3686
|
+
if (nb && Math.abs(lo(nb.rect, axis) + len(nb.rect, axis) + gap - lo(landed.rect, axis)) > 1 && Math.abs(lo(landed.rect, axis) + len(landed.rect, axis) + gap - lo(nb.rect, axis)) > 1) return false;
|
|
3687
|
+
const n = neighbors(layout, e.id, dragged, axis);
|
|
3688
|
+
if (taken.some((r) => Math.abs(lo(r, axis) - lo(landed.rect, axis)) < pitch / 2)) return true;
|
|
3689
|
+
taken.push(landed.rect);
|
|
3690
|
+
const result = { scene: next, layout };
|
|
3691
|
+
const kept = Math.round(next.items[dragged]?.space ?? 0);
|
|
3692
|
+
const target = { id: `pitch:${e.id}:${zone}:${at}:${Math.round(space)}`, priority: 2, hit: landed.rect, slot: landed.rect, item: dragged, place: { kind: "gap", edge: e.id, zone, at }, after: () => result };
|
|
3693
|
+
const id = `${e.id}/${zone}/${n.before}|${n.next}@${flush !== void 0 && kept > 0 ? `to:${flush}` : Math.round(kept / pitch)}`;
|
|
3694
|
+
out.push({ lane: e.id, edge: e.id, axis, id, ...n, landing: landed.rect, layout, target, hit: landed.rect, pitched: true });
|
|
3695
|
+
return true;
|
|
3696
|
+
};
|
|
3697
|
+
return ({ a, b, w, zones, atOf, spaceAt, before, after }) => {
|
|
3698
|
+
const end = (x0, order, flush) => {
|
|
3699
|
+
for (const zone of order) if (spaceAt(zone, x0) >= -EPS && emit3(zone, atOf(zone), Math.max(0, spaceAt(zone, x0)), x0, flush)) return;
|
|
3700
|
+
};
|
|
3701
|
+
end(a, zones, before?.id ?? "^");
|
|
3702
|
+
if (b - w > a + EPS) end(b - w, [...zones].reverse(), after?.id ?? "$");
|
|
3703
|
+
if (b - a < w + pitch) return;
|
|
3704
|
+
for (let x0 = a + pitch; x0 + w <= b - pitch + EPS; x0 += pitch) {
|
|
3705
|
+
const zone = x0 + w / 2 < middle ? "start" : "end";
|
|
3706
|
+
if (!zones.includes(zone)) continue;
|
|
3707
|
+
emit3(zone, atOf(zone), spaceAt(zone, x0), x0);
|
|
3708
|
+
}
|
|
3709
|
+
};
|
|
3710
|
+
});
|
|
3711
|
+
return out;
|
|
3712
|
+
}
|
|
3713
|
+
function stretches(scene, dragged, options, seen, lifted, raws, visit) {
|
|
3714
|
+
if (!scene.items[dragged]) return;
|
|
3624
3715
|
const prev = options.previous ? { previous: options.previous } : {};
|
|
3716
|
+
const base = lifted;
|
|
3625
3717
|
for (const e of scene.edges) {
|
|
3626
3718
|
const bar = e.side === "top" || e.side === "bottom";
|
|
3627
3719
|
if (!bar && !e.compact) continue;
|
|
3628
3720
|
const axis = bar ? "x" : "y";
|
|
3629
3721
|
const mine = raws.filter((r) => r.edge === e.id);
|
|
3630
|
-
const drawn = seen.edges[e.id];
|
|
3722
|
+
const drawn = base.edges[e.id] ?? seen.edges[e.id];
|
|
3631
3723
|
if (mine.length === 0 || !drawn) continue;
|
|
3632
|
-
const w = len(mine[0].landing, axis);
|
|
3633
3724
|
const gap = nonNeg(e.gap);
|
|
3634
|
-
const others = onEdge(
|
|
3635
|
-
const edgeStart = lo(drawn.rect, axis) + nonNeg(e.pad?.start);
|
|
3636
|
-
const edgeEnd = lo(drawn.rect, axis) + len(drawn.rect, axis) - nonNeg(e.pad?.end);
|
|
3637
|
-
const middle = mid(drawn.rect, axis);
|
|
3725
|
+
const others = onEdge(base, e.id, dragged, axis);
|
|
3638
3726
|
const zoneOf2 = (o) => o.zone ?? "start";
|
|
3639
|
-
const
|
|
3640
|
-
const
|
|
3641
|
-
const place = { edge: e.id, zone, at, space };
|
|
3642
|
-
const next = moveTo(scene, dragged, place);
|
|
3643
|
-
if (next === scene) return;
|
|
3644
|
-
const layout = solve(next, prev);
|
|
3645
|
-
const landed = layout.items[dragged];
|
|
3646
|
-
if (!landed || landed.inMenu || landed.edge !== e.id || x0 !== void 0 && Math.abs(lo(landed.rect, axis) - x0) > 1) return;
|
|
3647
|
-
if (taken.some((r) => Math.abs(lo(r, axis) - lo(landed.rect, axis)) < pitch / 2)) return;
|
|
3648
|
-
taken.push(landed.rect);
|
|
3649
|
-
const result = { scene: next, layout };
|
|
3650
|
-
const target = { id: `pitch:${e.id}:${zone}:${at}:${Math.round(space)}`, priority: 2, hit: landed.rect, slot: landed.rect, item: dragged, place: { kind: "gap", edge: e.id, zone, at }, after: () => result };
|
|
3651
|
-
const n = neighbors(layout, e.id, dragged, axis);
|
|
3652
|
-
const id = `${e.id}/${zone}/${n.before}|${n.next}@${Math.round(space / pitch)}`;
|
|
3653
|
-
out.push({ lane: e.id, edge: e.id, axis, id, ...n, landing: landed.rect, layout, target, hit: landed.rect, pitched: true });
|
|
3654
|
-
};
|
|
3655
|
-
const spaced = (o) => !!o && (scene.items[o.id]?.space ?? 0) > 0;
|
|
3656
|
-
const own = scene.items[dragged];
|
|
3657
|
-
if (own && (own.space ?? 0) > 0 && seen.items[dragged]?.edge === e.id) {
|
|
3658
|
-
const zone = zoneIn(e, own);
|
|
3659
|
-
if (zone === "start") emit3("start", 0, 0);
|
|
3660
|
-
else if (zone === "end") emit3("end", others.filter((o) => zoneOf2(o) === "end").length, 0);
|
|
3661
|
-
}
|
|
3727
|
+
const w = len(mine[0].landing, axis);
|
|
3728
|
+
const each = visit({ e, axis, w, gap, middle: mid(drawn.rect, axis), mine, fixed: others.filter((o) => scene.items[o.id]?.fixed), prev });
|
|
3662
3729
|
const slack = (o) => {
|
|
3663
3730
|
const main = o ? scene.items[o.id]?.forms[axis === "x" ? "row" : "column"]?.[0]?.main : void 0;
|
|
3664
3731
|
return o && main?.grows ? Math.max(0, len(o.r, axis) - main.natural) : 0;
|
|
3665
3732
|
};
|
|
3733
|
+
const ends = (l, before, after) => {
|
|
3734
|
+
const at = (o) => {
|
|
3735
|
+
const it = l.items[o.id];
|
|
3736
|
+
return it && it.edge === e.id && !it.inMenu && !it.floating ? it.rect : null;
|
|
3737
|
+
};
|
|
3738
|
+
const rb = before ? at(before) : void 0;
|
|
3739
|
+
const ra = after ? at(after) : void 0;
|
|
3740
|
+
if (rb === null || ra === null) return null;
|
|
3741
|
+
const el = l.edges[e.id]?.rect ?? drawn.rect;
|
|
3742
|
+
return {
|
|
3743
|
+
a: before && rb ? lo(rb, axis) + len(rb, axis) - slack({ ...before, r: rb }) + gap : lo(el, axis) + nonNeg(e.pad?.start),
|
|
3744
|
+
// (Not before a growing item: a dock there keeps no space, the item it precedes takes all that is spare.)
|
|
3745
|
+
b: ra ? lo(ra, axis) - gap : lo(el, axis) + len(el, axis) - nonNeg(e.pad?.end)
|
|
3746
|
+
};
|
|
3747
|
+
};
|
|
3666
3748
|
for (let i = 0; i <= others.length; i++) {
|
|
3667
3749
|
const before = others[i - 1];
|
|
3668
3750
|
const after = others[i];
|
|
3669
|
-
const
|
|
3670
|
-
const
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3751
|
+
const zones = [...!before || zoneOf2(before) === "start" ? ["start"] : [], ...!after || zoneOf2(after) === "end" ? ["end"] : []];
|
|
3752
|
+
const atOf = (zone) => others.slice(0, i).filter((o) => zoneOf2(o) === zone).length;
|
|
3753
|
+
const probe = (() => {
|
|
3754
|
+
const zone = zones[0];
|
|
3755
|
+
if (!zone) return null;
|
|
3756
|
+
const next = moveTo(scene, dragged, { edge: e.id, zone, at: atOf(zone), space: 0 });
|
|
3757
|
+
if (next === scene) return null;
|
|
3758
|
+
const l = solve(next, prev);
|
|
3759
|
+
const landed = l.items[dragged];
|
|
3760
|
+
if (!landed || landed.inMenu || landed.edge !== e.id) return null;
|
|
3761
|
+
const n = neighbors(l, e.id, dragged, axis);
|
|
3762
|
+
if (n.before !== (before?.id ?? "^") || n.next !== (after?.id ?? "$")) return null;
|
|
3763
|
+
const r = ends(l, before, after);
|
|
3764
|
+
return r && { ...r, w: len(landed.rect, axis), layout: l };
|
|
3765
|
+
})();
|
|
3766
|
+
const seenEnds = ends(base, before, after);
|
|
3767
|
+
const pushed = (o, side) => !!o && !!probe && givesWay(base.items[o.id], probe.layout.items[o.id], e.id, side, (r) => [lo(r, axis), lo(r, axis) + len(r, axis) - slack({ ...o, r })]) === "moves";
|
|
3768
|
+
const a = probe && (zones.includes("start") || !pushed(before, "before")) ? probe.a : seenEnds.a;
|
|
3769
|
+
const b = probe && (zones.includes("end") || !pushed(after, "after")) ? probe.b : seenEnds.b;
|
|
3770
|
+
const wi = probe?.w ?? w;
|
|
3771
|
+
each({ before, after, a, b, w: wi, zones, atOf, spaceAt: (zone, x0) => zone === "start" ? x0 - a : b - (x0 + wi) });
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
function takeoverSpots(scene, dragged, options, seen, lifted, raws, pitch) {
|
|
3776
|
+
const out = [];
|
|
3777
|
+
stretches(scene, dragged, options, seen, lifted, raws, (run) => {
|
|
3778
|
+
const { e, axis } = run;
|
|
3779
|
+
const taken = [...run.mine.map((r) => r.landing)];
|
|
3780
|
+
const emit3 = (zone, at, space, x0, nb) => {
|
|
3781
|
+
const hit = landsAt(scene, dragged, run, { edge: e.id, zone, at, space }, x0);
|
|
3782
|
+
if (!hit) return;
|
|
3783
|
+
const { next, layout } = hit;
|
|
3784
|
+
const landed = layout.items[dragged];
|
|
3785
|
+
if (taken.some((r) => Math.abs(lo(r, axis) - lo(landed.rect, axis)) < pitch / 2)) return;
|
|
3786
|
+
taken.push(landed.rect);
|
|
3787
|
+
const n = neighbors(layout, e.id, dragged, axis);
|
|
3788
|
+
const result = { scene: next, layout };
|
|
3789
|
+
const target = { id: `pitch:${e.id}:${zone}:${at}:in:${nb}`, priority: 2, hit: landed.rect, slot: landed.rect, item: dragged, place: { kind: "gap", edge: e.id, zone, at }, after: () => result };
|
|
3790
|
+
out.push({ lane: e.id, edge: e.id, axis, id: `${e.id}/${zone}/${n.before}|${n.next}@in:${nb}`, ...n, landing: landed.rect, layout, target, hit: landed.rect });
|
|
3791
|
+
};
|
|
3792
|
+
return ({ w, zones, atOf, spaceAt, before, after }) => {
|
|
3793
|
+
const zoneOf2 = (id) => scene.items[id]?.align ?? "start";
|
|
3794
|
+
if (after && zones.includes("start") && zoneOf2(after.id) === "start" && !scene.items[after.id]?.fixed) {
|
|
3795
|
+
const x0 = lo(after.r, axis);
|
|
3796
|
+
emit3("start", atOf("start"), Math.max(0, spaceAt("start", x0)), x0, after.id);
|
|
3680
3797
|
}
|
|
3681
|
-
|
|
3682
|
-
|
|
3798
|
+
if (before && zones.includes("end") && zoneOf2(before.id) === "end" && !scene.items[before.id]?.fixed) {
|
|
3799
|
+
const x0 = lo(before.r, axis) + len(before.r, axis) - w;
|
|
3800
|
+
emit3("end", atOf("end"), Math.max(0, spaceAt("end", x0)), x0, before.id);
|
|
3801
|
+
}
|
|
3802
|
+
};
|
|
3803
|
+
});
|
|
3683
3804
|
return out;
|
|
3684
3805
|
}
|
|
3806
|
+
function landsAt(scene, dragged, run, place, x0) {
|
|
3807
|
+
const next = moveTo(scene, dragged, place);
|
|
3808
|
+
if (next === scene) return null;
|
|
3809
|
+
const layout = solve(next, run.prev);
|
|
3810
|
+
const landed = layout.items[dragged];
|
|
3811
|
+
const { axis } = run;
|
|
3812
|
+
if (!landed || landed.inMenu || landed.edge !== run.e.id || Math.abs(lo(landed.rect, axis) - x0) > 1) return null;
|
|
3813
|
+
if (run.fixed.some((f) => {
|
|
3814
|
+
const r = layout.items[f.id]?.rect;
|
|
3815
|
+
return !r || Math.abs(lo(r, axis) - lo(f.r, axis)) > 1;
|
|
3816
|
+
})) return null;
|
|
3817
|
+
return { next, layout };
|
|
3818
|
+
}
|
|
3819
|
+
function slidingSpots(scene, dragged, options, seen, lifted, raws, sample) {
|
|
3820
|
+
const spots = [];
|
|
3821
|
+
const absorbed = /* @__PURE__ */ new Set();
|
|
3822
|
+
const snapDistance = Number.isFinite(options.snapDistance) && options.snapDistance >= 0 ? options.snapDistance : SNAP_DISTANCE;
|
|
3823
|
+
const own = seen.items[dragged];
|
|
3824
|
+
const ownEdge = own && !own.floating && !own.inMenu ? own.edge : void 0;
|
|
3825
|
+
stretches(scene, dragged, options, seen, lifted, raws, (run) => ({ a, b, w, zones, atOf, spaceAt, before, after }) => {
|
|
3826
|
+
const { e, axis, middle, mine } = run;
|
|
3827
|
+
if (zones.length === 0) return;
|
|
3828
|
+
{
|
|
3829
|
+
const land = (x0) => {
|
|
3830
|
+
const near = x0 + w / 2 < middle ? "start" : "end";
|
|
3831
|
+
for (const zone2 of [near, near === "start" ? "end" : "start"]) {
|
|
3832
|
+
if (!zones.includes(zone2)) continue;
|
|
3833
|
+
const space = spaceAt(zone2, x0);
|
|
3834
|
+
if (space < -EPS) continue;
|
|
3835
|
+
const place = { edge: e.id, zone: zone2, at: atOf(zone2), space: Math.max(0, space) };
|
|
3836
|
+
const hit = landsAt(scene, dragged, run, place, x0);
|
|
3837
|
+
if (hit) return { place, result: { scene: hit.next, layout: hit.layout } };
|
|
3838
|
+
}
|
|
3839
|
+
return null;
|
|
3840
|
+
};
|
|
3841
|
+
const tries = [a];
|
|
3842
|
+
for (let x0 = a + sample; x0 < b - w - EPS; x0 += sample) tries.push(x0);
|
|
3843
|
+
if (b - w > a + EPS) tries.push(b - w);
|
|
3844
|
+
const ok = tries.map((x0) => ({ x0, hit: land(x0) })).filter((t) => t.hit);
|
|
3845
|
+
if (ok.length === 0) return;
|
|
3846
|
+
const from = ok[0].x0;
|
|
3847
|
+
const to = ok.at(-1).x0;
|
|
3848
|
+
const bId = before?.id ?? "^";
|
|
3849
|
+
const nId = after?.id ?? "$";
|
|
3850
|
+
if (to - from < STEP) {
|
|
3851
|
+
if (mine.some((r) => !r.slide && Math.abs(lo(r.landing, axis) - from) <= 1)) return;
|
|
3852
|
+
const firstZone = (() => {
|
|
3853
|
+
for (const zone3 of zones) {
|
|
3854
|
+
const space = spaceAt(zone3, from);
|
|
3855
|
+
if (space < -EPS) continue;
|
|
3856
|
+
const place2 = { edge: e.id, zone: zone3, at: atOf(zone3), space: Math.max(0, space) };
|
|
3857
|
+
const hit = landsAt(scene, dragged, run, place2, from);
|
|
3858
|
+
if (hit) return { place: place2, result: { scene: hit.next, layout: hit.layout } };
|
|
3859
|
+
}
|
|
3860
|
+
return null;
|
|
3861
|
+
})();
|
|
3862
|
+
const { place, result } = firstZone ?? ok[0].hit;
|
|
3863
|
+
const landed = result.layout.items[dragged].rect;
|
|
3864
|
+
const n = neighbors(result.layout, e.id, dragged, axis);
|
|
3865
|
+
const zone2 = place.zone;
|
|
3866
|
+
const isHome = ownEdge === e.id && !!own && Math.abs(lo(own.rect, axis) - lo(landed, axis)) <= 1 && Math.abs(len(own.rect, axis) - len(landed, axis)) <= 1;
|
|
3867
|
+
const target2 = { id: `pitch:${e.id}:${zone2}:${place.at}:${Math.round(place.space ?? 0)}`, priority: 2, hit: landed, slot: landed, item: dragged, place: { kind: "gap", edge: e.id, zone: zone2, at: place.at }, after: () => result };
|
|
3868
|
+
const plain = `${e.id}/${zone2}/${n.before}|${n.next}`;
|
|
3869
|
+
const id = mine.some((r) => r.id === plain) ? `${plain}@${Math.round((place.space ?? 0) / sample)}` : plain;
|
|
3870
|
+
spots.push({ lane: e.id, edge: e.id, axis, id, ...n, landing: landed, layout: result.layout, target: target2, hit: landed, ...isHome ? { home: true } : {} });
|
|
3871
|
+
return;
|
|
3872
|
+
}
|
|
3873
|
+
const inside = mine.filter((r) => !r.slide && r.before === bId && r.next === nId && Math.abs(len(r.landing, axis) - w) <= 1 && lo(r.landing, axis) >= from - 1 && lo(r.landing, axis) <= to + 1);
|
|
3874
|
+
for (const r of inside) absorbed.add(r);
|
|
3875
|
+
const homeRaw = inside.find((r) => r.home);
|
|
3876
|
+
const points = [];
|
|
3877
|
+
const put = (at2, raw) => {
|
|
3878
|
+
const same = points.find((p) => Math.abs(p.at - at2) < 1e-6);
|
|
3879
|
+
if (!same) points.push({ at: at2, ...raw ? { raw } : {} });
|
|
3880
|
+
else if (raw && !same.raw) same.raw = raw;
|
|
3881
|
+
};
|
|
3882
|
+
put(from);
|
|
3883
|
+
put(to);
|
|
3884
|
+
for (const r of [...inside].sort((p, q) => p.home ? -1 : q.home ? 1 : 0)) put(lo(r.landing, axis), r);
|
|
3885
|
+
const homeAt = homeRaw ? lo(homeRaw.landing, axis) : void 0;
|
|
3886
|
+
const kept = points.filter((p) => homeAt === void 0 || Math.abs(p.at - homeAt) < 1e-6 || Math.abs(p.at - homeAt) > 2 * snapDistance).sort((p, q) => p.at - q.at);
|
|
3887
|
+
const snaps = kept.map((p) => p.at);
|
|
3888
|
+
const dockAt = (x0) => kept.find((p) => Math.abs(p.at - x0) < 1e-6)?.raw;
|
|
3889
|
+
const shape = ok[0].hit.result.layout.items[dragged].rect;
|
|
3890
|
+
const at = (x0) => along(shape, axis, x0, x0 + w);
|
|
3891
|
+
const snapped = (x0) => {
|
|
3892
|
+
let best = x0;
|
|
3893
|
+
let d = Infinity;
|
|
3894
|
+
for (const q of snaps) if (Math.abs(q - x0) <= snapDistance && Math.abs(q - x0) < d) [best, d] = [q, Math.abs(q - x0)];
|
|
3895
|
+
return best;
|
|
3896
|
+
};
|
|
3897
|
+
const startAt = (raw) => {
|
|
3898
|
+
const c = clamp(raw, from, to);
|
|
3899
|
+
const s = snapped(c);
|
|
3900
|
+
return snaps.includes(s) ? s : clamp(Math.round(c / STEP) * STEP, from, to);
|
|
3901
|
+
};
|
|
3902
|
+
const results = /* @__PURE__ */ new Map();
|
|
3903
|
+
const commitAt = (x0) => {
|
|
3904
|
+
const r = dockAt(x0);
|
|
3905
|
+
const k = `${r ? "dock " : ""}${Math.round(x0 * 1e3) / 1e3}`;
|
|
3906
|
+
const known = results.get(k);
|
|
3907
|
+
if (known) return known;
|
|
3908
|
+
const result = r ? r.target.after(ORIGIN, ORIGIN) : land(x0)?.result ?? ok.reduce((p, q) => Math.abs(q.x0 - x0) < Math.abs(p.x0 - x0) ? q : p).hit.result;
|
|
3909
|
+
results.set(k, result);
|
|
3910
|
+
return result;
|
|
3911
|
+
};
|
|
3912
|
+
const rest = homeRaw ? lo(homeRaw.landing, axis) : ownEdge === e.id && own ? snapped(clamp(lo(own.rect, axis), from, to)) : from;
|
|
3913
|
+
const restResult = commitAt(rest);
|
|
3914
|
+
const ownZone = own?.zone;
|
|
3915
|
+
const restPlace = (() => {
|
|
3916
|
+
if (homeRaw) return ownZone && zones.includes(ownZone) ? { zone: ownZone, at: atOf(ownZone), space: Math.max(0, spaceAt(ownZone, rest)) } : land(rest)?.place;
|
|
3917
|
+
const p = dockAt(rest)?.target.place;
|
|
3918
|
+
return p && p.kind === "gap" ? p : land(rest)?.place;
|
|
3919
|
+
})();
|
|
3920
|
+
const landing = homeRaw ? homeRaw.landing : restResult.layout.items[dragged]?.rect ?? at(rest);
|
|
3921
|
+
const ownLen = own ? Math.max(own.rect.width, own.rect.height) : 0;
|
|
3922
|
+
const long = own && own.rect.width >= own.rect.height ? "x" : "y";
|
|
3923
|
+
const target = {
|
|
3924
|
+
id: `slide:${e.id}:${bId}|${nId}`,
|
|
3925
|
+
priority: 2,
|
|
3926
|
+
hit: hull2(at(from), at(to)),
|
|
3927
|
+
slot: landing,
|
|
3928
|
+
item: dragged,
|
|
3929
|
+
place: { kind: "gap", edge: e.id, zone: restPlace?.zone ?? zones[0], at: restPlace?.at ?? atOf(zones[0]), ...restPlace?.space ? { space: restPlace.space } : {} },
|
|
3930
|
+
after: (point, grab) => {
|
|
3931
|
+
const g = grab ? grab[long] : ownLen / 2;
|
|
3932
|
+
const share = axis === long && ownLen > EPS && Number.isFinite(g) ? clamp(g / ownLen, 0, 1) : 0.5;
|
|
3933
|
+
return commitAt(startAt((axis === "x" ? point.x : point.y) - share * w));
|
|
3934
|
+
}
|
|
3935
|
+
};
|
|
3936
|
+
const zone = zones[0];
|
|
3937
|
+
spots.push({
|
|
3938
|
+
lane: e.id,
|
|
3939
|
+
edge: e.id,
|
|
3940
|
+
axis,
|
|
3941
|
+
id: `${e.id}/${zone}/${bId}|${nId}@slide`,
|
|
3942
|
+
before: bId,
|
|
3943
|
+
next: nId,
|
|
3944
|
+
landing,
|
|
3945
|
+
layout: restResult.layout,
|
|
3946
|
+
target,
|
|
3947
|
+
hit: target.hit,
|
|
3948
|
+
...homeRaw ? { home: true } : {},
|
|
3949
|
+
slide: { from, to, snaps, snapDistance, step: STEP, first: at(from), last: at(to) }
|
|
3950
|
+
});
|
|
3951
|
+
}
|
|
3952
|
+
});
|
|
3953
|
+
return { spots, absorbed };
|
|
3954
|
+
}
|
|
3685
3955
|
|
|
3686
3956
|
export {
|
|
3687
3957
|
SIDES,
|
|
@@ -3743,4 +4013,4 @@ export {
|
|
|
3743
4013
|
HATCH_END,
|
|
3744
4014
|
HATCH_EDGE
|
|
3745
4015
|
};
|
|
3746
|
-
//# sourceMappingURL=chunk-
|
|
4016
|
+
//# sourceMappingURL=chunk-UPZXNTIR.js.map
|