Repository navigation
Pill: drag from anywhere, keep its state while dragged, never render empty - #32
Merged
Merged
Conversation
…iming PillGeometry.dockedOrigin places a docked panel (anchor + clamp) for both the settled pill and a drag, so a press that has not moved moves nothing (the drag skipped the clamp: the peek dock dropped 11 pt). Drag threshold, grab offset and drag-along helpers, and PillMotion (spring durations + settleDelay), all tested.
…empty - Every point of the capsule but a real button drags past a 6 pt threshold; a press that does not travel is a click. The peek dock's fields were Buttons, so the dock could not be dragged at all and the pointer slid off it. - A drag keeps the pill's phase, size and peek until the drop: requests that arrive meanwhile (a dictation ending, a meeting starting) land at the drop; a hover exit no longer collapses the dock mid-drag. - Phase changes during a drag drew the capsule outside its panel (empty or half-cut) and the settle threw the panel back to where the drag began. - The panel settles on a timer (PillMotion): SwiftUI's completion never fired for a rise or a sink, so the panel stayed a stage with the dock's surface held. - settle() lands a phase still waiting for its turn instead of dropping it. - A start from the dock morphs instead of rising, whose hidden content showed a dock-sized empty capsule. - Open-hand cursor on the body that drags, closed while dragging.
press:<spot> / move:<dx>:<dy> / release drive a drag through the pill's own window (synthesized events, a film pointer instead of the cursor, the tracking area's mid-drag exit emulated); --start-delay / --start-block give a start from the pill the app's async meeting start and blocking dictation capture; fired actions print in film mode; the film pointer is drawn on the frames.
PillPress decides click or drag from the pointer's travel ON SCREEN and never calls a press that became a drag a click. PillDragHold holds requests during a drag (latest wins) except a capture going hot. PillTransitionLedger keeps the transition generation and its pending shape, which a settle lands instead of dropping. alongCapsule maps a screen point onto the capsule's own axis.
- The controller owns the press, measured on screen: a drag dropped without the gesture can no longer end as a click, and a press while the dock opens is a click on the field it aims at (resolved on the settled dock). - show() drops a released drag before cancelling the auto-hide, and hideTask is never reassigned without a cancel: a held phase's replayed timer no longer dismisses the phase that came after it. - A 0.25 s button watch ends a drag whose mouse-up was lost; a capture going hot is never held by a drag: its bar shows at once where the pill is dragged. - VoiceOver gets the capsule's click as named actions.
Owner
Author
|
Review round (6 items) — fixed on this branch:
|
This was referenced Nov 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three user-reported pill bugs, each traced to its mechanism and filmed before/after with
pillsandbox(newpress:/move:/releasesteps drive a real drag through the pill's own window;--start-delay/--start-blockgive a start from the pill the app's timing).1. No place to start a drag
Cause. The peek dock is four fields, and each was a SwiftUI
Button(DictationPillView.swift,PillDockTile). A Button takes the press, so the capsule's.gesture(DragGesture)never started from the dock — which is all the resting pill ever shows under the pointer. Filmed: a press on the dock and a 240 pt move leave the dock in place while the pointer slides off it.Fix. One
DragGesture(minimumDistance: 0)for the whole capsule: pastPillGeometry.dragThreshold(6 pt) it drags, below it it is a click on whatever is under it. The dock's fields are no longer Buttons (still buttons to VoiceOver, still squash when pressed). Real buttons (Stop, a prompt's answers, ✕, a fault's action) keep their press and never drag. Cursor: open hand on the body that only drags, pointing hand where a click acts, closed hand while dragging (DictationPillModel.cursor, re-asserted on every pointer move — the app is never active, so cursor rects don't run). No grip mark: the whole pill drags, and the bars' widths stay as tuned.2. The dragged pill collapsed and jumped
Causes.
handleHover(false)started the 450 ms linger andsetPeeking(false)→show(.idle)sank the dock into its edge at the OLD saved spot during the drag.dockedCenteronly, skipping the clamp the settled pill gets (activeOrigin), so the dock (thicker than the reference size) dropped 11 pt on the first drag frame.Fix. A drag session (
isDragging): the pill keeps its phase, size and peek until the drop; hover changes don't collapse it; everyshow/hide that arrives meanwhile is held and the latest lands at the drop (upcomingState/currentStatereport it, so the coordinator's ownership rules still hold); the pointer is re-read at the drop, so a dock dropped with the pointer off it tucks at its new place. Settled and dragged panels both go throughPillGeometry.dockedOrigin, so a press that hasn't moved moves nothing. A drag whose mouse-up never reached the gesture is dropped as soon as the left button is up.3. An empty pill while active
Causes.
transitiongrows the panel into a stage and offsets the capsule on it; the nextdragMoved()wrote the dragged frame over the stage without zeroing the offset, so the capsule was drawn off its own window — empty or half-cut — and the spring's settle then threw the panel back to where the drag began. Filmed:before-done-dragframes 90–92..risecue, whose content stays hidden until the capsule "has left the edge": from the dock (already out) that is a dock-sized empty capsule, frozen for as long as the main thread is busy starting the capture (Recorder.start()/DictationCapture.start()run on it). Filmed in a real screen grab too.withAnimation(_:completionCriteria:_:completion:), which never fired for a transition that starts a move and a reshape in the same turn — every rise and sink. The panel stayed a stage, the dock's surface stayed held, until the next morph (for the whole length of a meeting).settle()dropped a phase still waiting for its turn (the generation bump), so a settle in that turn (a drag starting) could leave the new phase never applied.Fix. The drag session above; a start from the dock morphs (content visible from the first frame); the panel settles on a timer from
PillMotion.settleDelay(KleothCore, tested);settle()lands a pending phase at once; hover and peek decisions read the phase still to land (upcomingPhase), so a hover can no longer peek the dock over a.listeningasked for in the same turn.Tests
PillDragTests(5 new, KleothCore): no jump at drag start on every edge for the dock, a bar and the reference panel; the dock clamped inward; the grabbed point stays under the pointer; click vs drag threshold; settle waits for the last beat.swift build && swift test: 790 tests.swift build --package-path app,swift test --package-path app.KLEOTH_NO_INSTALL=1 bash app/make-app.sh releasewith its smoke test.Not verified by film (needs eyes on the real app)
.borderlessbuttons (AppKit tracking loop) — not with the old view either.No version bump.