@n-uf/motion 26.11.51 → 26.11.52
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 +147 -0
- package/dist/drag.d.ts +114 -16
- package/dist/drag.js +297 -116
- package/dist/drag.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,153 @@
|
|
|
3
3
|
Versions are calendar versions, `YY.M.R` (year, month of the release, counter
|
|
4
4
|
within the month), the same scheme as `@n-uf/hypr-tiling`.
|
|
5
5
|
|
|
6
|
+
## 26.11.52
|
|
7
|
+
|
|
8
|
+
- `./drag`, **one estimate of the hand's speed** (fix, design). Fast or slow was decided four ways (a frame's step, a
|
|
9
|
+
six-sample window, and per gate), and the six-sample window read a fling that started from a rest or a hesitation as
|
|
10
|
+
slow: its first steps counted as a slide, and a fling out of a 40 ms hesitation, or out of a rest, docked in the rail.
|
|
11
|
+
Now every gate that asks fast or slow (the slide count into a touching lane and its entry, the settle rule after a
|
|
12
|
+
fling, the slow path) reads one estimate, `createHandSpeed` (`src/drag/hand-speed.ts`, `HAND_SPEED`): the newest step
|
|
13
|
+
reads a speed-up at once; the speed over at least 48 ms and 5 steps reads a slow-down only once it has lasted; the
|
|
14
|
+
speed is the larger. A gap of 40 ms or more starts the hand again (its step unknown, never slow), so a rest is never
|
|
15
|
+
averaged into the next fling; a slide counts only while the hand reads steady, not gathering speed. A property sweep
|
|
16
|
+
(`test/landing-hand-speed-sweep.test.ts`: 125 and 60 Hz, timestamps off by 0 to 50% of a frame, rests up to 1000 ms,
|
|
17
|
+
ramps up to 60 ms) proves it: every slide at 0.6 to 1.9 px/ms enters, every fling at 2.4 px/ms or faster never enters
|
|
18
|
+
before it settles (an immediate release goes home), and 80 ms of rest after it docks; the 60 Hz case with timestamps
|
|
19
|
+
half a frame off, excluded before, is closed. Host notes: a slide into a touching lane counts only once the hand's
|
|
20
|
+
speed is known and steady, a span and a half (72 ms at 125 Hz, 120 ms at 60 Hz); a host sampling slower than 25 Hz
|
|
21
|
+
slides into a touching lane only by that lane's own gates.
|
|
22
|
+
|
|
23
|
+
- `./drag`, **under "all" the shared corner goes to the lane nearest the pointer within reach** (behavior change). With
|
|
24
|
+
no Near lane (the pointer over a refused column, crossing toward an empty rail under an empty bar) the bar kept the
|
|
25
|
+
corner until entry, when the rail's box jumped 29 px up into it. Now the corner goes to the lane with `entry` nearest
|
|
26
|
+
the pointer within `approach.reach`, for the corner only: that lane isn't made Near, pending or enterable, and nothing
|
|
27
|
+
more shows (under `"near"` still no guide over a refused place). It shows its mark at entry less the landing it would
|
|
28
|
+
take there, as the Near lane does, so nothing jumps at entry. Beyond reach of every such lane, the bar keeps it.
|
|
29
|
+
|
|
30
|
+
- `./drag`, **the Near guide leaves out the held toolbar at its landing** (behavior change). A host cut the held
|
|
31
|
+
toolbar's floating rect out of the guides, so before entry the guide was cut wherever the toolbar floated and at
|
|
32
|
+
entry wherever it landed: an empty top bar's guide went from `421..867` to `3..347` and `453..867`. The landing model
|
|
33
|
+
now cuts the Near lane's guide at the landing the held toolbar takes there (held: the frame's `landing`) or would take
|
|
34
|
+
(pending or approached: the spot the pointer picks along the lane, a sliding spot's start from the grab), by
|
|
35
|
+
`guideRects`' interval subtraction; a lane with no marks (its spots' landings are its guides) is not cut, and a part
|
|
36
|
+
the cut leaves no longer than `MIN_BOX_LENGTH` (8 px: the padding before a landing at its clamp) is not drawn, as a
|
|
37
|
+
host's own cut would drop it. Host notes:
|
|
38
|
+
**do not pass the held toolbar's drawn rect in `guideRects`' `clear`**: the guides already leave the held landing
|
|
39
|
+
out.
|
|
40
|
+
|
|
41
|
+
- `./drag`, **a flick settles before a slow step counts** (fix). After a fast step any distinct sample, even 0.3 px of
|
|
42
|
+
jitter, was a slow step at once, so a real hand's jitter after a flick docked it on the next frame, and an immediate
|
|
43
|
+
release did not go home. Now after a step above `gates.slide` no lane is entered by a slow-step gate (the still gate,
|
|
44
|
+
the over-refused rule, a touching lane's takeover by it) until the hand has been slow (every step at most
|
|
45
|
+
`gates.step`, or resting) for `pause` (60 ms). Resting still docks after about 60 ms, as before; on the stage's edge a
|
|
46
|
+
fling is still taken at once; the slow path and a slow slide, which have no fast step, are unaffected.
|
|
47
|
+
- `./drag`, **a touching lane's takeover reads the over-refused rule** (fix). Over a place that takes nothing (an empty
|
|
48
|
+
rail's band over a column) a lane is entered on the first slow step, but a touching lane's takeover from a held lane
|
|
49
|
+
read only that lane's own gates, so after a flick up the rail from the bar under it a rest at x 25 in a 30 px rail
|
|
50
|
+
(depth 5, under `depth`) never docked: the held bar pre-empted the rule. The takeover now reads it too.
|
|
51
|
+
- `./drag`, **the Near lane shows its marks once entered, and owns the corner it shares** (additive). A
|
|
52
|
+
`LandingLane` may carry **`entry`** (its marks while it is the lane the pointer picks, where they differ from
|
|
53
|
+
`marks`: placement's prediction of an empty lane's marks once entered) and **`corners`** (the lanes those overlap).
|
|
54
|
+
The lane the Near rule picks (held, pending or approached) shows `entry` in place of `marks`, under `"near"` and
|
|
55
|
+
`"all"`, so an empty lane's guide before entry is its mark after it. Under `"all"` the lanes in its `corners` are cut
|
|
56
|
+
where they overlap it, by `guideRects`' interval subtraction, so the corner goes to that lane; with no such lane every
|
|
57
|
+
lane shows its `marks` (where the bar keeps a shared corner), and no two lanes' guides overlap on any frame. Host
|
|
58
|
+
notes: lanes without `entry` show as before; nothing to change.
|
|
59
|
+
|
|
60
|
+
- `./drag`, **the pending lane holds at a corner** (fix). Inside two lanes not entered that overlap at a corner (an
|
|
61
|
+
empty top bar's band and an empty rail's), `pending` was the deeper of the two on every frame, so a wobble of a few
|
|
62
|
+
pixels across the diagonal flipped it, and the Near guides with it (9 times on a short zigzag). The pending lane now
|
|
63
|
+
holds while the pointer stays inside it, and the other takes over only once it is deeper by `margins.spot` (6 px).
|
|
64
|
+
- `./drag`, **a fling is no entry into a touching lane** (behavior change, a new gate). From a held lane, a lane that
|
|
65
|
+
touches it took the pointer once it had slid `path` px along it at any speed, so a fast flick up an empty rail from
|
|
66
|
+
the bar under it docked the toolbar in the rail on release. The slide now counts only at a brisk hand: a new gate
|
|
67
|
+
**`LandingGates.slide`**, default 16 px per 8 ms (2 px/ms). Above it a fling, along the lane as well as across it, is
|
|
68
|
+
no entry, and its frames add nothing to the slide count (nor reset it). Fast or slow, for the count, is the speed
|
|
69
|
+
over the hand's last six samples and at least 24 ms, not one frame: so a fling whose timestamps jitter never reads
|
|
70
|
+
slow on a frame, a fling that slows for a frame or two still docks nowhere (only `path` px slid at or below the gate
|
|
71
|
+
does), and a steady slide whose timestamps jitter past the gate now and then keeps its count. After a fling the
|
|
72
|
+
count starts once the hand reads slow over that window; the lane is entered only by its own gate, the slow `path` or
|
|
73
|
+
a rest past `pause`. The cost: above 2 px/ms a
|
|
74
|
+
hand sliding along a corner lane keeps the previous lane's end spot until it slows or rests. Host notes: a host that
|
|
75
|
+
wants the old rule sets `gates: { slide: Infinity }`. `LandingGates.slide` is a new required member: a host that
|
|
76
|
+
builds a full `LandingGates` literal adds it (`slide: 16`, or spreads `LANDING_GATES`); a host that passes
|
|
77
|
+
`Partial<LandingGates>` (`options.gates`) is unaffected.
|
|
78
|
+
- `./drag`, **far beyond the held lane the frame is held but refused** (behavior change). Inside a touching lane not
|
|
79
|
+
entered, the held lane held however far the pointer went, so after a flick up a rail that didn't enter it the frame
|
|
80
|
+
said "the bar, its home spot, landing at home" 288 px above the bar, and nothing told the user the release goes home.
|
|
81
|
+
The hold through a touching lane is for crossing a corner: more than `path` (40 px) past the held lane's exit margin
|
|
82
|
+
the frame is now `region: "refused"`, its `lane` kept (its guides stay), `spot` and `landing` null and no `pending`;
|
|
83
|
+
`release()` is null (home). The refusal is sticky, as the lift zone is: it lets go only within `exit + path - spot`
|
|
84
|
+
(46 px by default), so a hand wobbling at its edge never flips lane and refused. Host notes: a host that shows "Can't go here" for a
|
|
85
|
+
refused frame with no `pending` shows it there; nothing to change.
|
|
86
|
+
- `./drag`, **a Near guide shows a lane only where the pointer can enter it** (behavior change, a default). With
|
|
87
|
+
`placeGuides: "near"`, a lane's guides showed from the nearest lane within `reach` (80 px), and over a refused place
|
|
88
|
+
(a column that takes nothing) from the nearest lane at any distance, so a toolbar carried toward an empty side rail
|
|
89
|
+
beside a panel column showed the rail's box 200 to 300 px away, a place it could not enter yet. That second rule is
|
|
90
|
+
deleted. Now a Near guide shows for the held lane (also over its own refused stretch); else the pending lane (the
|
|
91
|
+
pointer inside it, its gate not passed); else, with the pointer in open space, the approached lane, the nearest within
|
|
92
|
+
`approach.reach`, which now defaults to the entry margin (`LANDING_MARGINS.exit`, 12 px, was 80). Over a refused place
|
|
93
|
+
outside every lane no guide shows. `LandingApproach` and its hysteresis stay (a lane is kept until another is `nearer`
|
|
94
|
+
closer), with one default more: `keep` is 12 (was 96), and is read as at least `reach`, so a lane acquired within
|
|
95
|
+
reach is never dropped at once. Otherwise a guide would linger up to 96 px after the pointer left the lane, in open
|
|
96
|
+
space where a release floats. A lane is acquired only within `max(reach - margins.spot, reach / 2)` (6 px; half the reach where the spot margin
|
|
97
|
+
would leave less, a small `reach` or touch margins) and kept to `reach`, so a
|
|
98
|
+
pointer wobbling across the reach's edge never blinks the guide (with `keep` equal to `reach` there was no band).
|
|
99
|
+
Host notes: a host that wants the early guide sets `approach: { reach: 80, keep: 96 }`
|
|
100
|
+
(the old values); nothing else to change. That restores the early guide in open space only: over a refused place no
|
|
101
|
+
guide shows at any reach.
|
|
102
|
+
- `./drag`, **`guideRects` thins a box a clear rect pokes into** (fix, rule C3). A clear rect, grown by its clearance,
|
|
103
|
+
that covered only part of a box's thickness always cut the box along its length on the facing side, so a neighbor
|
|
104
|
+
poking 2 px into an 868 x 29 bar cost the bar 49 px of length. Now, when its overlap across the box is smaller than its
|
|
105
|
+
overlap along it and it reaches one side of the box, it thins the box from that side by that overlap and no length:
|
|
106
|
+
2 px less thickness. The deepest intrusion from each side wins, whatever the order. The order is: thinnings, then the
|
|
107
|
+
full-thickness interval subtraction and the corner cuts in sorted order, then `minLength` and the ids by interior
|
|
108
|
+
cuts. A box thinned below `minThickness` is dropped. Only a shallow intrusion thins, at most half the box's
|
|
109
|
+
thickness: a rect that pokes in deeper (the held item's outline flush with one side of a bar, which would leave a
|
|
110
|
+
4 px sliver), as deep as it is long, or touches neither side, is a corner as before. Behavior change: a shallow, long
|
|
111
|
+
poke now removes thickness where it removed length.
|
|
112
|
+
- `./drag`, **`guideRects` ids count only interior cuts** (fix). A full-thickness clear interval that touches or
|
|
113
|
+
overlaps the box's start or end trims the box and is no cut; only intervals strictly inside the box (box length on
|
|
114
|
+
both sides) count. A neighbor toolbar flush with the box's start, its 2 px clearance over the first 2 px, used to
|
|
115
|
+
count as a cut and renamed the real before-part of a held rect `<id>#2` (and the after-part `<id>#3`); now they are
|
|
116
|
+
`<id>` and `<id>#2`. One consequence: while a held rect overlaps the box's start, the single part left after it is
|
|
117
|
+
`<id>`, not `<id>#2`.
|
|
118
|
+
- `./drag`, **`guideRects` cuts a box by one model** (fix; additive optional `axis` on `PlacedGuide`). The first
|
|
119
|
+
version of the split above re-derived a box's orientation for every part, so after one cut a part narrower than the
|
|
120
|
+
box is thick turned the next clear rect into a corner cut: it kept one piece with no `minLength`, lost one of the
|
|
121
|
+
parts and gave a result that depended on the order of the clear rects; ids were numbered by rank among the survivors,
|
|
122
|
+
so they churned as the held item slid. Now: one axis per box (its long side, decided once from the box clipped to
|
|
123
|
+
`inside`; a square takes the guide's `axis`, else x). Every clear rect across the box's whole thickness is subtracted
|
|
124
|
+
as an interval along the axis, so the result equals a 1-D interval subtraction in any order. Corner rects then cut
|
|
125
|
+
each part on the facing side, in order of their distance along the axis. `minLength` applies once, at the end, to
|
|
126
|
+
every cut part, corner-cut ones included (a part nothing touched is kept as it is). Ids follow the side: `<id>`
|
|
127
|
+
before any full-thickness cut, `<id>#<k + 1>` after k of them, so the part before a cut is always `<id>` and the part
|
|
128
|
+
after one cut always `<id>#2`, whether or not the part before survives. A guide's own `id` must not end in `#` and
|
|
129
|
+
digits, and an `id` that is not a string is not suffixed (unsupported for a split box). Behavior change: a split
|
|
130
|
+
box's far part keeps `<id>#2` where it was `<id>` when the part before it fell under `minLength`.
|
|
131
|
+
- `./drag`, **`guideRects` keeps both parts of a box a clear rect splits** (fix; additive option `minLength`, export
|
|
132
|
+
`MIN_BOX_LENGTH`). A box over the room on both sides of a sliding held item, with the item's outline passed as a
|
|
133
|
+
`clear` rect, was cut "on the side facing the rect" and kept only its larger part, so the far side's mark (about
|
|
134
|
+
107 to 183 px in a toolbar bar or rail) disappeared, and the kept side flipped as the item moved. A clear rect across
|
|
135
|
+
a box's whole thickness now leaves the part before it and the part after it, each kept when at least `minLength` px
|
|
136
|
+
long (default 8); one over an end leaves the other part as before; one over part of the thickness (a corner) keeps
|
|
137
|
+
the cut on the facing side, no L-shapes. A split box comes back as two guides: the first keeps the guide's `id`, the
|
|
138
|
+
second gets `<id>#2`, so a host keys each part by its id. A part under `minLength` left by such a cut is no
|
|
139
|
+
longer drawn.
|
|
140
|
+
- `./drag`, **`createLandingModel` measures a lane's depth across it, not from its ends** (fix). The `depth` gate (a
|
|
141
|
+
still pointer 8 px inside a lane enters it) counted every side of the lane's rect that is not on the stage's edge, so
|
|
142
|
+
a rail's end that meets a bar counted as a wall: a still pointer 6 px above that end was never deep enough, and the
|
|
143
|
+
drop landed nowhere. Depth now counts only from the two sides parallel to the lane's axis that face into the stage
|
|
144
|
+
(a rail's long sides); a lane's ends along its own axis never count. A fly-through of a thin bar or rail still opens
|
|
145
|
+
no room (the `path` gate and the sides across it are unchanged), and a fast pass along a rail's end does not enter it.
|
|
146
|
+
The one visible change: a still pointer near a lane's end is as deep as anywhere along it.
|
|
147
|
+
- Docs: **the hand rule** for `createLandingModel`, in one wording with placement's. While a lane holds, the landing is
|
|
148
|
+
the nearest landing in its lane to the pointer, within `max(48, g / 2 + 6)` px of it (`max(56, g / 2 + 6)` on the
|
|
149
|
+
frame before a hop), `g` the gap along the lane between the facing edges of the two adjacent landings the pointer
|
|
150
|
+
lies between. Before, the reference said "up to 56 px on the frame before the hop, 48 px on every other", which a
|
|
151
|
+
docked item much longer than the held one exceeds. No behavior changes.
|
|
152
|
+
|
|
6
153
|
## 26.11.51
|
|
7
154
|
|
|
8
155
|
Host notes: none.
|
package/dist/drag.d.ts
CHANGED
|
@@ -484,13 +484,30 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
|
|
|
484
484
|
* stretch it is at that spot; over a refused stretch of the lane, refused ("Can't go here"). (Placement's `lanes()`
|
|
485
485
|
* joins a refused stretch shorter than the item to its spots.)
|
|
486
486
|
* - **Entering a lane** needs one of two gates: `path` px of slow pointer path along it inside it (steps of at most
|
|
487
|
-
* `step`), or a still step (at most `still`) once `depth` px inside, the depth
|
|
488
|
-
* face into the stage (on the edge it is deep)
|
|
487
|
+
* `step`), or a still step (at most `still`) once `depth` px inside, the depth measured across the lane: only from its
|
|
488
|
+
* two sides parallel to its axis that face into the stage (on the edge it is deep), never from its ends along its axis
|
|
489
|
+
* (a rail's end that meets a bar is no wall). A fly-through of a thin bar or rail at any angle meets neither, so its
|
|
489
490
|
* room never opens. Inside a lane that touches the held one, past the held lane's exit margin, the held lane holds
|
|
490
|
-
* until that lane's gate passes or the pointer has slid `path` px along it
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
491
|
+
* until that lane's gate passes or the pointer has slid `path` px along it (across it at most a third as far) as a
|
|
492
|
+
* steady slide no faster than `slide` (2 px/ms), as the hand's speed reads it: lane to lane never passes through the
|
|
493
|
+
* float, and never opens a crossed lane's room. A fling, along the lane or across it, is no entry: the touching lane is
|
|
494
|
+
* entered only by its own gate (the slow path, or a rest past `pause`). The cost: above 2 px/ms a hand sliding along a
|
|
495
|
+
* corner lane keeps the previous lane's end spot until it slows or rests, and a slide counts only once the hand's
|
|
496
|
+
* speed is known and steady (a span and a half, 72 ms at 125 Hz, 120 ms at 60 Hz). The hold through a touching lane is
|
|
497
|
+
* for crossing a corner: more than `path` past the held lane's exit margin the frame is held but refused (the lane
|
|
498
|
+
* kept for its guides; no spot, no landing, nothing pending; a release goes home), sticky until the pointer is back
|
|
499
|
+
* within `exit + path - spot`. Over a refused place (a lane's band lying over a column that takes nothing: an empty
|
|
500
|
+
* side rail's) a lane is entered on the first slow step there (not on the lift), as there is nothing else to mean
|
|
501
|
+
* there; a fly-through still opens no room. A touching lane's takeover reads the same rule, so a held lane never
|
|
502
|
+
* pre-empts it. After a fling (the hand's speed above `slide`) no lane is entered by a slow-step gate (still,
|
|
503
|
+
* over-refused) until the hand has read slow (or rested) for `pause`: jitter right after a flick docks nothing, while
|
|
504
|
+
* on the stage's edge a fling is taken at once.
|
|
505
|
+
* - **The hand's speed** (`createHandSpeed`, ./hand-speed) is the one estimate every gate that asks "fast or slow"
|
|
506
|
+
* reads: the slide count and its entry, the settle rule, the slow path. It reads a speed-up at once (the newest step)
|
|
507
|
+
* and a slow-down only once it has lasted its span (at least 48 ms and 5 steps), so a fling whose timestamps jitter
|
|
508
|
+
* never reads slow; a gap of 40 ms or more (a rest, a hesitation) starts the hand again, so a rest is never averaged
|
|
509
|
+
* into the next fling; and a slide counts only while the hand reads steady (not gathering speed). A host sampling
|
|
510
|
+
* slower than 25 Hz (every step a gap) slides into a touching lane only by its own gates. A lane that owns
|
|
494
511
|
* its rect (`owns`: a rail drop strip at the window's side) takes the pointer inside it from any lane it overlaps, a
|
|
495
512
|
* held one too, once its own gate passes and only once the pointer came into it from outside since the lift. Within
|
|
496
513
|
* `margins.lift` of the lift point (`options.lift`, else the first point; fixed for the drag) an owning lane takes the
|
|
@@ -516,8 +533,22 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
|
|
|
516
533
|
* refuses nothing) refused.
|
|
517
534
|
* - **Shift** turns a lane or open space into open space (the float), and hides the guides.
|
|
518
535
|
* - **Guides** are the lane's `marks` (lines between items, a box per free stretch, in the layout as drawn), else its
|
|
519
|
-
* spots' landings
|
|
520
|
-
*
|
|
536
|
+
* spots' landings. `"near"` shows a lane only where the pointer can enter it: the held lane's (also over its own
|
|
537
|
+
* refused stretch); else the pending lane's (the pointer inside it, its gate not passed: a release floats or goes
|
|
538
|
+
* home); else, with the pointer in open space, the approached lane's (the nearest within `reach`, by default the
|
|
539
|
+
* entry margin `exit`, acquired within `max(reach - spot, reach / 2)` and kept to `reach`, so it never blinks at the
|
|
540
|
+
* edge: a release floats). Over a refused place outside every lane no guide shows, however near the lane behind it
|
|
541
|
+
* lies; a host that wants the early guide sets `approach.reach` (in open space only: over a refused place none shows
|
|
542
|
+
* at any reach). That lane (the one the Near rule picks) shows its `entry` marks where it has them (placement's
|
|
543
|
+
* prediction of an empty lane's marks once entered), so its guide before entry is its mark after it. Its guide leaves
|
|
544
|
+
* out the held toolbar at the landing it takes there (held) or would take (the spot the pointer picks, a sliding
|
|
545
|
+
* spot's start from the grab), never at its floating rect, so a host passes no held rect in `guideRects`' `clear`; a
|
|
546
|
+
* part that cut leaves no longer than `MIN_BOX_LENGTH` (the padding before a clamped landing) is not drawn. `"all"`
|
|
547
|
+
* shows every lane's; the lane the Near rule picks shows its `entry` and owns every corner it shares: each lane it
|
|
548
|
+
* names in `corners` is cut where it overlaps it, by the interval subtraction of `guideRects`. With no Near lane, the
|
|
549
|
+
* corner goes to the lane with `entry` nearest the pointer within `reach`, for the corner only (it isn't made Near,
|
|
550
|
+
* pending or enterable). Beyond reach of every such lane, every lane's `marks`, where the bar keeps a shared corner.
|
|
551
|
+
* No two lanes' guides overlap on any frame.
|
|
521
552
|
* - Steps are measured between points that differ, normalized to 125 Hz, so the gates read the same at any input rate.
|
|
522
553
|
* A repeated point keeps the last step; it is still only once the pointer has stayed put for `rest` ms.
|
|
523
554
|
*
|
|
@@ -581,6 +612,14 @@ interface LandingLane {
|
|
|
581
612
|
}[];
|
|
582
613
|
/** Its guides' marks; absent, its spots' landings are the guides. */
|
|
583
614
|
readonly marks?: readonly LandingMark[];
|
|
615
|
+
/**
|
|
616
|
+
* Its marks while it is the lane the pointer picks (held, pending or approached), where they differ from `marks`: a
|
|
617
|
+
* prediction of its marks once entered that owns a corner `marks` gives up (placement's `lanes()` gives it for an empty
|
|
618
|
+
* lane). Shown in place of `marks` then, and under `"all"` every lane in `corners` is cut where it overlaps it.
|
|
619
|
+
*/
|
|
620
|
+
readonly entry?: readonly LandingMark[];
|
|
621
|
+
/** The lanes whose marks `entry` overlaps: cut where they overlap it while this lane is the one the pointer picks. */
|
|
622
|
+
readonly corners?: readonly string[];
|
|
584
623
|
/**
|
|
585
624
|
* Its rect is its own (a rail drop strip at the window's side): inside it, once its gate passes, it takes the pointer
|
|
586
625
|
* from any lane it overlaps, a held one too. Absent: where lanes overlap, the deeper one wins.
|
|
@@ -632,13 +671,33 @@ interface LandingGates {
|
|
|
632
671
|
* `step`) or it is on the stage's edge (a fling there is taken at once); repeated points before it aren't still.
|
|
633
672
|
*/
|
|
634
673
|
readonly rest: number;
|
|
635
|
-
/**
|
|
674
|
+
/**
|
|
675
|
+
* The time a pointer that last moved fast has to stay put before it counts as still, ms: longer than sample gaps. Also
|
|
676
|
+
* the settle window after a fling (a step above `slide`): no lane is entered by a slow-step gate (still, over-refused)
|
|
677
|
+
* until the hand has been slow, or resting, this long.
|
|
678
|
+
*/
|
|
636
679
|
readonly pause: number;
|
|
680
|
+
/**
|
|
681
|
+
* The largest step at which a slide along a lane touching the held one takes it, px per 8 ms (default 16: 2 px/ms).
|
|
682
|
+
* Above it a fling is no entry; the lane's own gate (the slow path, or a rest past `pause`) still enters it.
|
|
683
|
+
*/
|
|
684
|
+
readonly slide: number;
|
|
637
685
|
}
|
|
638
|
-
/**
|
|
686
|
+
/**
|
|
687
|
+
* The approach for near guides, with the pointer in open space: the nearest lane within `reach`, kept until another is
|
|
688
|
+
* `nearer` closer or past `keep` (read as at least `reach`: a kept lane is never shown past it). The guide shows only
|
|
689
|
+
* within `reach` of the lane, so by default only where the pointer can enter it.
|
|
690
|
+
*/
|
|
639
691
|
interface LandingApproach {
|
|
692
|
+
/**
|
|
693
|
+
* How near a lane's rect the pointer is in open space for the lane's guides to show, px (default 12: the entry
|
|
694
|
+
* margin). A lane is acquired within `max(reach - margins.spot, reach / 2)` and kept until `reach` (or `keep`), so
|
|
695
|
+
* at the edge the guide never blinks.
|
|
696
|
+
*/
|
|
640
697
|
readonly reach: number;
|
|
698
|
+
/** How far a kept lane stays the approached one, px (default 12). Below `reach` it is `reach`. */
|
|
641
699
|
readonly keep: number;
|
|
700
|
+
/** How much nearer another lane has to be to take over from the kept one, px (default 16). */
|
|
642
701
|
readonly nearer: number;
|
|
643
702
|
}
|
|
644
703
|
declare const LANDING_MARGINS: LandingMargins;
|
|
@@ -772,6 +831,11 @@ declare function createGripPress(options?: {
|
|
|
772
831
|
interface PlacedGuide {
|
|
773
832
|
readonly kind: "line" | "box" | "hatch";
|
|
774
833
|
readonly rect: Rect;
|
|
834
|
+
/**
|
|
835
|
+
* The axis of the lane the guide marks, when the guide knows it. It only decides a box that is no longer than it is
|
|
836
|
+
* thick (a square): its long side is its axis, and a square has none, so `axis` (default `"x"`) says.
|
|
837
|
+
*/
|
|
838
|
+
readonly axis?: "x" | "y";
|
|
775
839
|
}
|
|
776
840
|
/** A rect guides stay clear of, with a clearance of its own, px (0: guides may lie flush against it). */
|
|
777
841
|
interface ClearRect {
|
|
@@ -797,17 +861,51 @@ interface GuideRectsOptions {
|
|
|
797
861
|
readonly clear?: readonly (Rect | ClearRect)[];
|
|
798
862
|
/** How far clear of a plain `clear` rect a guide stays, px (default 2): "clear of" means at least this far. */
|
|
799
863
|
readonly clearance?: number;
|
|
800
|
-
/** The least thickness a thin guide keeps, px (default 2); thinner, it is not drawn. */
|
|
864
|
+
/** The least thickness a thin guide keeps, px (default 2); thinner, it is not drawn. A box a clear rect thinned is held to it too. */
|
|
801
865
|
readonly minThickness?: number;
|
|
866
|
+
/**
|
|
867
|
+
* The least length, along the box's axis, a part of a box that a clear rect cut keeps, px (default 8,
|
|
868
|
+
* `MIN_BOX_LENGTH`); shorter, that part is not drawn. Corner-cut parts included; a box nothing touches is kept as is.
|
|
869
|
+
*/
|
|
870
|
+
readonly minLength?: number;
|
|
802
871
|
}
|
|
872
|
+
/** The least length, px, a box part a clear rect cut keeps (`minLength`'s default). */
|
|
873
|
+
declare const MIN_BOX_LENGTH = 8;
|
|
803
874
|
/**
|
|
804
875
|
* Where to draw guides: every guide inside `inside` by `inset`, and at least `clearance` px clear of every `clear` rect
|
|
805
876
|
* ("clear of" means at least that far: a plain rect keeps the options' `clearance`, default 2; `{ rect, clearance }`
|
|
806
877
|
* keeps its own, so pass `{ rect, clearance: 0 }` for content a thin guide may run flush against, and `kinds` to
|
|
807
|
-
* constrain only some kinds of guide, default all). A box is clipped,
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
878
|
+
* constrain only some kinds of guide, default all). A box is clipped, then each clear rect, grown by its clearance, is
|
|
879
|
+
* taken out of it, by one model:
|
|
880
|
+
*
|
|
881
|
+
* - One axis per box: its long side, decided once from the box clipped to `inside`, before any clear rect is applied
|
|
882
|
+
* (a square takes the guide's `axis`, else x). Cutting a box never turns its axis.
|
|
883
|
+
* - Thinning comes first. A clear rect over only part of the thickness that reaches one side of the box thins it when
|
|
884
|
+
* its overlap across the box is smaller than its overlap along it: the box loses that thickness from that side and no
|
|
885
|
+
* length (a neighbor poking 2 px into a bar costs 2 px of thickness, not its whole length in the bar's length). The
|
|
886
|
+
* deepest intrusion from each side wins, whatever the order. Only a shallow intrusion thins, at most half the box's
|
|
887
|
+
* thickness. A box thinned below `minThickness` is dropped. A rect that pokes in deeper than half the thickness (the
|
|
888
|
+
* held outline flush with one side), as deep as it is long, or touches neither side, is a corner (below).
|
|
889
|
+
* - A clear rect across the box's whole thickness (of the thinned box) is an interval along the axis, and the box less all of them is a
|
|
890
|
+
* 1-D interval subtraction: inside the box (the held item's outline sliding inside its room) both sides stay, over
|
|
891
|
+
* one end the other side. The result does not depend on the order of the clear rects.
|
|
892
|
+
* - A clear rect over only part of the thickness (a corner) then cuts each part on the side that faces it, the
|
|
893
|
+
* largest part kept (no L-shapes). Corners are applied by their distance along the axis (start, then end, then
|
|
894
|
+
* across), whatever the input order, so the result is the same for any order.
|
|
895
|
+
* - `minLength` (default 8, `MIN_BOX_LENGTH`) is applied once at the end, along the axis, to every part a clear rect
|
|
896
|
+
* cut, corner-cut ones included. A part nothing touched is the clipped box and is kept at any length.
|
|
897
|
+
* - Ids follow the side, not the rank: a part keeps the guide's `id` when no interior cut lies before it along the
|
|
898
|
+
* axis, and gets `<id>#<k + 1>` when k of them do. A cut is a full-thickness clear interval strictly inside the box
|
|
899
|
+
* (box length on both sides of it); overlapping or touching ones count as one, and one that touches or overlaps the
|
|
900
|
+
* box's start or end only trims the box, it is no cut (a neighbor flush with the box's start, grown by its clearance,
|
|
901
|
+
* leaves the part before a held rect as `<id>`). The part before a cut is always `<id>`, the part after one cut
|
|
902
|
+
* always `<id>#2`, whether or not the part before survives, so a host keys each part by its id as a held item slides.
|
|
903
|
+
* The exception: while the held rect overlaps the box's start (or end) it only trims the box, so the part left is
|
|
904
|
+
* `<id>`, and it becomes `<id>#2` once the held rect lies strictly inside the box. A guide's own `id` must not end in `#` and digits
|
|
905
|
+
* (`b#2` would collide with the second part of `b`), and an `id` that is not a string is not suffixed (a split
|
|
906
|
+
* box's parts then share it: unsupported). Parts come back in order along the axis.
|
|
907
|
+
*
|
|
908
|
+
* A thin guide (a line, a striped strip or end: its
|
|
811
909
|
* shorter side is its thickness) keeps its thickness and moves inside rather than being clipped, so a line at a lane's
|
|
812
910
|
* far end is as thick as at its head. Then it is thinned, from the content side, to stay that far clear of `clear`, so
|
|
813
911
|
* a thin strip at the window's side lies between the inset and the content, the same on both sides. A guide with nothing left (or a thin one under `minThickness`) is left out. A clear rect whose x, y, width or height isn't finite is ignored. Pure; the guides come
|
|
@@ -815,4 +913,4 @@ interface GuideRectsOptions {
|
|
|
815
913
|
*/
|
|
816
914
|
declare function guideRects<G extends PlacedGuide>(guides: readonly G[], options: GuideRectsOptions): G[];
|
|
817
915
|
|
|
818
|
-
export { type ClearRect, DRAG_DEFAULTS, DRAG_PREVIEW_DEFAULT, DoubleClick, type DragFrame, type DragIntent, type DragIntentOptions, type DragIntentState, type DragKeys, type DragModifiers, type DragPreview, type DragTarget, type DragTuning, type DropPreviewMode, type EmptyLanes, type GripPress, type GripRelease, type GuideRectsOptions, LANDING_APPROACH, LANDING_GATES, LANDING_MARGINS, LANDING_TOUCH_MARGINS, type LandingApproach, type LandingFrame, type LandingGates, type LandingGuide, type LandingLane, type LandingMargins, type LandingMark, type LandingModel, type LandingOptions, type LandingRegion, type LandingRegions, type LandingRelease, type LandingSlide, type LandingSpot, type LiftDecision, type ModifierKey, PLACE_GUIDES_DEFAULT, type PlaceGuides, type PlacedGuide, type PreviewPlan, REFUSAL_RANK, SNAP_DISTANCE, createDragIntent, createGripPress, createLandingModel, guideRects, inRect, liftDecision, pickRank, previewPlan, targetAt };
|
|
916
|
+
export { type ClearRect, DRAG_DEFAULTS, DRAG_PREVIEW_DEFAULT, DoubleClick, type DragFrame, type DragIntent, type DragIntentOptions, type DragIntentState, type DragKeys, type DragModifiers, type DragPreview, type DragTarget, type DragTuning, type DropPreviewMode, type EmptyLanes, type GripPress, type GripRelease, type GuideRectsOptions, LANDING_APPROACH, LANDING_GATES, LANDING_MARGINS, LANDING_TOUCH_MARGINS, type LandingApproach, type LandingFrame, type LandingGates, type LandingGuide, type LandingLane, type LandingMargins, type LandingMark, type LandingModel, type LandingOptions, type LandingRegion, type LandingRegions, type LandingRelease, type LandingSlide, type LandingSpot, type LiftDecision, MIN_BOX_LENGTH, type ModifierKey, PLACE_GUIDES_DEFAULT, type PlaceGuides, type PlacedGuide, type PreviewPlan, REFUSAL_RANK, SNAP_DISTANCE, createDragIntent, createGripPress, createLandingModel, guideRects, inRect, liftDecision, pickRank, previewPlan, targetAt };
|