@n-uf/placement 26.12.9 → 26.12.10

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
@@ -5,6 +5,16 @@ Versions are calendar versions, `YY.M.R` (year, month of the release, counter wi
5
5
 
6
6
  Unreleased entries live in `changes/` until a release joins them.
7
7
 
8
+ ## 26.12.10
9
+
10
+ - **Changed (breaking in behavior, not in types):** under a fold, on the base basis, a pane you see folded takes no
11
+ drop: the hold does not change to a place of a pane drawn as a strip at the lift and in the frame drawn for the hold,
12
+ unless it already holds a place of that pane; there the hold and its frame stay. Before, a pointer on its way to a
13
+ strip took a place of that pane a few px early, and its preview moved the strip away. The place below such a pane is
14
+ no longer reached from home; it still is with nothing held, or once the pane is drawn open.
15
+ - **Changed:** the hit conformance's `hold-measures` no longer counts a kept place as past both measures where the
16
+ map's place names a pane drawn as a strip at the lift and in the kept place's frame.
17
+
8
18
  ## 26.12.9
9
19
 
10
20
  - **Changed (breaking in behavior, not in types):** under a fold, the hit on the base basis reads a strip from the
package/dist/tiling.d.ts CHANGED
@@ -726,6 +726,12 @@ interface TilingAfter<T, K> extends TilingLaidOut<T, K> {
726
726
  * (home stays home, a held place stays held and a release commits it as previewed, nothing stays nothing). Off the
727
727
  * frame's rails the hold follows the basis's zone map. So on the base basis the open panes are tested against the
728
728
  * base while another frame may be painted; only a painted strip is read from the frame on screen.
729
+ * - **A pane you see folded takes no drop** (under a fold, on the base basis). The hold does not change to a place
730
+ * whose pane is a strip both at the lift and in the frame drawn for the hold, unless the hold is already a place of
731
+ * that pane; where such a place is refused the hold stays as it is, and so does its frame. Off the strip the read
732
+ * names no strip (`folded` is null). It is one check on the place's pane, no geometry: a pane open at the lift, a
733
+ * pane the frame draws open (with nothing held the base is drawn), the lift basis and a layout without a fold are
734
+ * held as before. So the place beside such a pane is reached only from a frame that draws it open.
729
735
  *
730
736
  * See docs/placement.md, Entry: tiling, "A tiling drag's hit half".
731
737
  */
@@ -861,7 +867,11 @@ interface TilingHit<T, K> {
861
867
  readonly intent: TilingHitIntent<K>;
862
868
  /** The zone map: the place id at `point` with nothing held (`"home"` for home), or null. Pure. */
863
869
  placeAt(point: Point): string | null;
864
- /** The hold rule: what is held at `point` after `state` (null: nothing held yet). Pure: a host with no intent steps it itself. */
870
+ /**
871
+ * The hold rule: what is held at `point` after `state` (null: nothing held yet). Pure: a host with no intent steps it
872
+ * itself. On the base basis it never changes to a place of a pane drawn as a strip at the lift and in the frame drawn
873
+ * for `state`, unless `state` is already a place of that pane; there it stays `state`.
874
+ */
865
875
  hold(state: TilingHold | null, point: Point): TilingHold | null;
866
876
  /** The place an id names (hosts never parse ids). */
867
877
  heldOf(id: string): TilingHeld<K> | null;
@@ -990,7 +1000,9 @@ interface TilingDrag<T, K> {
990
1000
  * The drag's hit half on `basis`, built from that one layout and fixed for the drag: `"lift"` for a host that draws
991
1001
  * marks over the lift, `"base"` for one that draws the held place's landed layout. Remembered per basis, as `after` is
992
1002
  * per place: every call on one basis gives the same hit, with its one hold, and the first call's options stand. A
993
- * fresh hold is the pure `hit.hold(state, point)`.
1003
+ * fresh hold is the pure `hit.hold(state, point)`. Under a fold, on the base basis, a pane you see folded takes no
1004
+ * drop: the hold does not change to a place of a pane drawn as a strip at the lift and in the frame drawn for the
1005
+ * hold, unless it already holds a place of that pane.
994
1006
  */
995
1007
  hit(basis: TilingBasis, options?: TilingHitOptions<K>): TilingHit<T, K>;
996
1008
  }
package/dist/tiling.js CHANGED
@@ -1404,6 +1404,15 @@ function createTilingHit(ctx, basis, options = {}) {
1404
1404
  const place = byId.get(state2.place);
1405
1405
  return place ? after(place.held) : base;
1406
1406
  };
1407
+ const paneOf = (place) => place.held.kind === "home" ? null : place.held.at;
1408
+ const seenFolded = (state2, place) => {
1409
+ if (basis !== "base") return false;
1410
+ const pane = paneOf(place);
1411
+ if (pane === null || !lift.spines.has(pane)) return false;
1412
+ const held = state2 === null ? null : byId.get(state2.place);
1413
+ if (held && paneOf(held) === pane) return false;
1414
+ return frameOf(state2).spines.has(pane);
1415
+ };
1407
1416
  const hold = (state2, p) => {
1408
1417
  if (onRailOf(frameOf(state2), p)) return basis === "lift" ? null : state2;
1409
1418
  if (onRail(p)) return null;
@@ -1413,6 +1422,7 @@ function createTilingHit(ctx, basis, options = {}) {
1413
1422
  const held = byId.get(state2.place);
1414
1423
  if (held && (near2(held, p) || keepsByTravel(held, state2.from, p))) return state2;
1415
1424
  }
1425
+ if (now && seenFolded(state2, now)) return state2;
1416
1426
  return now ? { place: now.id, from: { x: p.x, y: p.y } } : null;
1417
1427
  };
1418
1428
  let state = null;
@@ -1951,7 +1961,8 @@ var TILING_HIT_PROPERTIES = [
1951
1961
  /**
1952
1962
  * A path within the edge measure of the held zone's visible part, or inside its pane (not over home) within the travel
1953
1963
  * measure of where it was taken, never changes the place; and a point past both (over home's rim on the base included,
1954
- * where a zone runs on beneath home) reads the zone map.
1964
+ * where a zone runs on beneath home) reads the zone map, unless the map's place there names a pane drawn as a strip at
1965
+ * the lift and in the frame drawn for the place (a pane you see folded takes no drop).
1955
1966
  */
1956
1967
  "hold-measures",
1957
1968
  /** A straight sweep meets each place but home (which shows nothing) at most once. */
@@ -2420,6 +2431,9 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
2420
2431
  if (kept?.place !== taken.place || hit.placeAt(p) === taken.place) continue;
2421
2432
  const shownFrame = basis === "lift" ? drag.lift : drag.after(hit.heldOf(taken.place));
2422
2433
  if (shownFrame.folds.some((f, i) => f.railOf === i && inside2(f.rail, p))) continue;
2434
+ const mapHeld = hit.placeAt(p) === null ? null : hit.heldOf(hit.placeAt(p));
2435
+ const takenHeld = hit.heldOf(taken.place);
2436
+ if (basis === "base" && mapHeld && mapHeld.kind !== "home" && drag.lift.spines.has(mapHeld.at) && shownFrame.spines.has(mapHeld.at) && !(takenHeld && takenHeld.kind !== "home" && takenHeld.at === mapHeld.at)) continue;
2423
2437
  if (!(home && inside2(home, p)) && Math.abs(p.x - taken.from.x) < travel && Math.abs(p.y - taken.from.y) < travel) continue;
2424
2438
  if (probed++ >= 24) break;
2425
2439
  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)})`);