@n-uf/placement 26.11.32 → 26.11.33

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 CHANGED
@@ -3,8 +3,16 @@
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.32
6
+ ## 26.11.33
7
+
8
+ - `./scene`, fixed: **a float stored taller than the clear stage was drawn over the bars.** `solve` sized a float to the
9
+ floats' region (the stage less its left and right inset), so one stored at the body's height lay over the top and
10
+ bottom bars by their height. Its size is now clamped to the room that region leaves clear of the bars and chrome
11
+ across it, along each axis, never under its floor (`floatMin`, else its form's minimums); only a floor larger than
12
+ that room keeps the floor and covers (`float-covers`). It is the one clamp `fitResize` lays floats with, so a resize
13
+ still previews its commit. A stored oversize float is drawn clear on the next `solve`; `readScene` is unchanged.
7
14
 
15
+ ## 26.11.32
8
16
  - `./scene/cases`, **`requires.intent`** (additive) and **row R4b-leaving-the-band**: a row that checks what a drag
9
17
  intent adds to the pick at a point names `requires: { intent: true }`, and a host without one (the in-memory host)
10
18
  skips it. R4b leaves a shown gap from inside its hit: just past the hit the intent's band holds it, past the band
@@ -529,6 +529,25 @@ function floatFloor(item, form, orient2, size) {
529
529
  height: item.floatMin ? px(item.floatMin.height) : Math.min(size.height, px(row ? form?.cross.min : form?.main.min))
530
530
  };
531
531
  }
532
+ function clearSize(region, avoid) {
533
+ const span = (axis) => {
534
+ const lo = axis === "y" ? region.y : region.x;
535
+ const hi = lo + (axis === "y" ? region.height : region.width);
536
+ const mid = (lo + hi) / 2;
537
+ let a = lo;
538
+ let b = hi;
539
+ for (const r of avoid) {
540
+ const whole = axis === "y" ? r.x <= region.x + EPS && r.x + r.width >= region.x + region.width - EPS : r.y <= region.y + EPS && r.y + r.height >= region.y + region.height - EPS;
541
+ const s = axis === "y" ? r.y : r.x;
542
+ const e = s + (axis === "y" ? r.height : r.width);
543
+ if (!whole || e <= lo || s >= hi) continue;
544
+ if (s + e <= 2 * mid) a = Math.max(a, e);
545
+ else b = Math.min(b, s);
546
+ }
547
+ return Math.max(0, b - a);
548
+ };
549
+ return { width: span("x"), height: span("y") };
550
+ }
532
551
  function placeFloat(item, f, region, avoid, content, stage) {
533
552
  const shape = floatShape(item, f);
534
553
  const from = shape.form;
@@ -536,9 +555,10 @@ function placeFloat(item, f, region, avoid, content, stage) {
536
555
  const form = formsOf(item, fo)[from];
537
556
  const floor = floatFloor(item, form, fo, shape);
538
557
  const cap = { width: Number.isFinite(item.floatMax?.width) ? item.floatMax.width : Infinity, height: Number.isFinite(item.floatMax?.height) ? item.floatMax.height : Infinity };
539
- const w = Math.max(floor.width, Math.min(shape.width, region.width, cap.width));
558
+ const clear = clearSize(region, avoid);
559
+ const w = Math.max(floor.width, Math.min(shape.width, clear.width, cap.width));
540
560
  const folded = form?.kind === "header";
541
- const h = folded ? shape.height : Math.max(floor.height, Math.min(shape.height, region.height, cap.height));
561
+ const h = folded ? shape.height : Math.max(floor.height, Math.min(shape.height, clear.height, cap.height));
542
562
  const want = f.anchor ? anchored(content, w, h, f.anchor) : rect(finite(f.rect.x, stage.x), finite(f.rect.y, stage.y), w, h);
543
563
  const fit0 = fitFloat(want, region, avoid);
544
564
  const fit = w > region.width + EPS ? { ...fit0, rect: rect(region.x, fit0.rect.y, w, fit0.rect.height) } : fit0;
@@ -2634,4 +2654,4 @@ export {
2634
2654
  refusals,
2635
2655
  stops
2636
2656
  };
2637
- //# sourceMappingURL=chunk-COK4YNMF.js.map
2657
+ //# sourceMappingURL=chunk-IOTKOYKW.js.map