Repository navigation
feat(motion): add Handoff::select safe selection-indicator helper and tighten motion truth matrix active check - #574
Merged
Merged
Conversation
… tighten motion truth matrix active check
…ts, other_near <=, and fmt clean
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.
Summary
Adds
motion::Handoff::select— a hard-to-misuse selection-indicator helper that encapsulates theHandoff::partlifecycle so downstream tab strips, tab bars, and sidebar pills cannot accidentally collapse handoffs into 1-frame snaps — and closes the 1 P2 + 1 Nit follow-up from #573.Motivation & Adoption Plan
Low-level
Handoff::part(seen, gave=...)requires callers to keepseen(at) > 0.0across synchronous signal flips and to reset outgoingways(part.still()) only insidegave. Callers that naively passfn(_) { if active() { 1.0 } else { 0.0 } }or callpart.still()immediately whenactive()turnsfalsesilently turn every tab/selection switch into a 1-frame snap becauseactive()flips before the incoming peer runscame.Built-in
packages/lgsegmented controls and bottom tabs useglass::DampedDrag(interactive finger-draggable pill with gesture projection), whereas downstream desktop tab strips, tab bars, and sidebar selection indicators usemotion::Handofffor click/keyboard selection-pill glide —Handoff::selectis the direct drop-in replacement for those downstreamHandoff::partcallers.Changes
packages/motion/src/handoff.pion:pub fn Handoff::select(self, v, active, spec?, tag?, carries?) -> HandPart:showingandleft_at(seen(at) = if showing && at <= left_at { 1.0 } else { 0.0 }) so same-timestamp switches hand off smoothly regardless of reactive watcher registration order, while clearing selection (active -> falsewith no peer taking over) expires immediately on later timestamps (at > left_at) instead of ghost-gliding from an invisible prior item.part.still()only insidegave, preserving live mid-flight geometry and velocity across rapid switches and reversals (A -> B -> C,A -> B -> A).takes=false) and cleans up cleanly onvdisposal (part.gone(), clearingpart_refso zero RC cycles remain).HandPart::cameandHandPart::other_nearwindow checks from<to<=soHandoff::new(within=0.0)allows same-timestamp handoffs consistently.Handoff::partcaveat and pointed selection-indicator callers toHandoff::select.packages/motion/src/zz_invar_handoff_select_test.pion:pionc fmt --checkclean) covering: initial mount at rest, forward (0 -> 2) and reverse (2 -> 0) mid-flight continuity (strict"a motion said is not at rest"check +ground_drawn.dx), rapid mid-flight reversals (0 -> 1 -> 2), empty-selection clear + wait pastmove_most_ms(dx == 0, no ghost glide), 1-framereduced_motion, active-tab disposal (dx == 0+ idle), andHandoff::new(within=0.0)forward & reverse watcher orders.packages/lg/src/motion_truth_matrix_test.pion(fix(view,lg): unmount View::show/pick leaves immediately under reduced_motion and expand Motion Truth Matrix to 18/18 Truth C #573 review follow-up):mt_assert_activeto require"a motion said is not at rest"and fixedpionc fmtindentation.Verification (
pvg-office-1,pion@c6c6dd79a7,PION_STRICT_STUB=1)pionc fmt --checkon both modified test files: PASSscripts/invar check --json: 58/58 PASSscripts/invar audit --json --require-reactive: 0 errors / 0 warningspionc test packages/motion: 43 passed / 0 failedHandoff::select(2 tests) underMBUI_TEST_MOTION=judgeacross 60 / 120 / 24 FPS: 3/3 PASSpionc test packages/kit: 75 passed / 0 failedpionc test packages/lg --filter "lg_motion_truth_": 3/3 PASS