@n-uf/placement 26.12.1 → 26.12.3

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/dist/tiling.d.ts CHANGED
@@ -164,8 +164,9 @@ declare function dropOnPane<K>(tree: Split<K> | null, dragged: K, at: K, region:
164
164
  /**
165
165
  * A side's fixed length along its split. A **kept** length (`keep`) is exact: it is cut only by its box, the extent
166
166
  * less the gutter, never by its sibling's need, it decides its split over a fixed length that is not kept, and it is
167
- * its pane's need. A fixed length that is not kept is taken as far as its box allows: the extent less the gutter and
168
- * its sibling's need.
167
+ * its pane's need. A fixed length that is not kept is honoured between the two needs: no shorter than its own side's
168
+ * need, no longer than what its sibling's need leaves (the extent less the gutter and that need). A host that wants a
169
+ * length under a pane's floor honoured reports the pane's need as at most the length.
169
170
  */
170
171
  interface FixedLength {
171
172
  readonly length: number;
@@ -209,9 +210,9 @@ interface SplitDecision {
209
210
  * `min(length, room)`, whatever its sibling needs; the other side takes the rest. Two kept lengths take
210
211
  * `min(first, room)` and `min(second, room − first)`, and what is left stays empty.
211
212
  * 3. **Fixed**: else the first side with a usable fixed length (above 0, finite; an unusable first lets the second
212
- * decide) takes `min(length, room − need of its sibling)`; the sibling takes the rest. Where its own need (at most
213
- * its length) and its sibling's don't fit the room, both are squeezed in proportion (step 5). The stored ratio is
214
- * never read.
213
+ * decide) takes its length held between the two needs, `min(max(length, own need), room − need of its sibling)`;
214
+ * the sibling takes the rest. Where the two needs don't fit the room, both are squeezed in proportion to them
215
+ * (step 5), whatever the length. The stored ratio is never read.
215
216
  * 4. **Ratio**: else the ratio is clamped so each side lands at its need: within
216
217
  * `[(needA + g/2) / E, 1 − (needB + g/2) / E]`. Where the net is on (neither side's `net` is false), each need is
217
218
  * first raised to `0.05 × E − g/2`, which is the 0.05..0.95 bound while the needs fit.
@@ -245,8 +246,10 @@ interface MinLength {
245
246
  * length (`keep`) is exact: cut only by its box (the extent less the gutter), it decides over a length that is not
246
247
  * kept, and it is its pane's need; two kept lengths keep their own and the room left stays empty, the second cut at
247
248
  * the split's end. Else the first side with a usable length (above 0, finite; an unusable first lets the second
248
- * decide) takes it as far as its box allows, the extent less the gutter and its sibling's need, and returns with the
249
- * room; where the needs don't fit, the split is squeezed. A split a fixed length decides has no divider; its stored
249
+ * decide) takes it held between the two needs: no shorter than its own need, no longer than the extent less the
250
+ * gutter and its sibling's need; where the needs don't fit, the split is squeezed by them. A pane's need is the host's
251
+ * floor, so a host that wants a length under that floor honoured gives the pane a floor no larger than the length; a
252
+ * split node's need is its panes' need. A split a fixed length decides has no divider; its stored
250
253
  * ratio is never read.
251
254
  * - `fixedAcross(child, axis)`: the child's fixed length across the split; the child takes it, when positive, finite
252
255
  * and shorter than the cross extent, from the start of the cross axis instead of the whole cross extent; a longer
@@ -297,8 +300,9 @@ interface SplitLayout<K> {
297
300
  * The least length `tree` lands at along `axis`, laid out alone in an area with `options`: where the area is at
298
301
  * least this long (allowing 1e-9 of it) along `axis`, no split on the way is squeezed by its needs, the net on or
299
302
  * off (a split a ratio decides with its net on needs room for the net's 5 % of its extent too). Except where the host
300
- * gives a split node its own fixed, kept or across length shorter than its need: that length is taken as it is, the
301
- * splits inside it along that axis are squeezed at any size, and its panes may land under their floors. It reads `floor`
303
+ * gives a split node its own kept or across length shorter than its need: that length is taken as it is, the splits
304
+ * inside it along that axis are squeezed at any size, and its panes may land under their floors. A fixed length that
305
+ * is not kept is no exception: a split node pinned shorter than its need lands at that need. It reads `floor`
302
306
  * and `fixed` as the layout does; no split measures the root, so a pane alone needs 0, and a split's own floor
303
307
  * counts only where a split above it measures it. 0 without `floor`. Not a side's need inside a tree: that is
304
308
  * `SplitGeometry.needs`, measured by its split. Not `StackFit.need` (what a stack's forms need).
package/dist/tiling.js CHANGED
@@ -173,10 +173,10 @@ function decideSplit(extent, gutter, ratio, a, b) {
173
173
  const length2 = Math.min(lead.length, room);
174
174
  return sides(first ? length2 : room - length2, "kept", false);
175
175
  }
176
- const own = Math.min(lead.length, first ? needA : needB);
176
+ const own = first ? needA : needB;
177
177
  const other = first ? needB : needA;
178
178
  if (own + other > room + FIT * E) return first ? squeeze(own, other, false) : squeeze(other, own, false);
179
- const length = Math.min(lead.length, room - other);
179
+ const length = Math.min(Math.max(lead.length, own), room - other);
180
180
  return sides(first ? length : room - length, "fixed", false);
181
181
  }
182
182
  const net = a.net !== false && b.net !== false ? Math.max(0, NET_SHARE * E - g / 2) : 0;