Skip to content

fix(glass,motion,ui): smooth DampedDrag jelly envelope and C1 spring reversal accounting (#567, #568) - #576

Merged
CommaBot merged 2 commits into
mainfrom
fix/glass-damped-drag-567-568
Dec 6, 2026
Merged

CommaBot merged 2 commits into
mainfrom
fix/glass-damped-drag-567-568

Conversation

@CommaBot

@CommaBot CommaBot commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #567
Closes #568

Summary

  1. #568 — Single-variable critically damped speed_spring (packages/glass/src/damped_drag.pion):

    • speed_spring was underdamped (ratio = 0.5, stiffness = 300.0), guaranteeing a negative zero-crossing overshoot during drag settle (+v -> 0 -> -0.163v -> 0). Combined with |speed / per| in DampedDrag::jelly, fast multi-step finger drags & reversals bounced back across zero while press was dropping, tripping sizes_across width stopped dead.
    • Switched speed_spring to critically damped (ratio = 1.0, stiffness = 300.0) while leaving DampedDrag::jelly 100% untouched (zero mid-speed stretch attenuation, full 1.25× stretch preserved).
    • Verified empirically that changing only settle_to while keeping ratio = 0.5 on update_value or narrowing a local jelly bowl still fails reversal drags (width stopped dead at 4100ms / 1783ms), whereas critically damped speed_spring(ratio = 1.0) alone passes all 34/34 packages/glass tests across all 5 FPS modes with zero mid-speed dulling.
  2. #567 — Opt-in C¹ velocity-preserving spring reversal accounting (packages/view, packages/motion, packages/ui/src/sizes_steady.pion):

    • Numerical decomposition of liquid_segmented_node 4 rapid reversed taps at 60fps showed pure motion::snappy_damped (ratio = 1.0, stiffness = 420.0) alone triggers sizes_steady's stopped dead check on 35.3% (156/442) of simple 2-tap reversals: by Newton's 2nd law, reversing a spring target mid-flight preserves C¹ position/velocity continuity while necessarily stepping acceleration discontinuously, causing d2 > stop_jerk * before at the turnaround apex.
    • Added motion-judge diagnostic hooks in packages/view/src/way_reversed.pion (View::note_way_reversed, View::is_motion_reduced, Tree::has_way_reversed, Tree::way_reversed_at, cleaned up via owns()).
    • Added explicit opt-in marks_turn? : Bool (default false) to NodeWay::go, enabled only on geometry-driving DampedDrag.value (update_value, settle_to, slide_to) — never on press, scale_x, scale_y, or speed — and checking both n.is_motion_reduced() (tree.motion_reduced) and ui::reduced_motion.
    • Updated sizes_steady_fault ONLY in the stopped dead branch (and updated its design-invariant comment): skips stopped dead when an opt-in C¹ spring reversal falls in (s0.1, s3.1], and drops stale pre-reversal d0 when in (ab.1, s0.1] while still enforcing post-reversal d2 <= stop_jerk * d1. All went spike checks, put() snaps, explicit velocity= impulses, Snap/Tween, and clamp cliffs remain 100% enforced.

Verification

  • pionc fmt --check on all changed/added files: pass
  • python3 scripts/invar check --json: ok: true
  • python3 scripts/invar audit --json --require-reactive: ok: true, error_count: 0, warning_count: 0
  • packages/glass: 34/34 across default + MBUI_TEST_MOTION=judge at 60, 120, 24, 7 FPS (including 8 new fast multi-step finger-drag/reversal probes, monotonic settle + full stretch unit test, and per-frame 2-hop reversal test)
  • packages/view: 226/226
  • packages/motion: 44/44 (including opt-in vs default marks_turn=false, same-dir, impulse, non-spring, put(), and reduced_motion negative tests)
  • packages/ui: 913/913 (including direct sizes_steady_fault positive + negative dead-stop/spike/5-sample tests)
  • packages/kit: 75/75, packages/lg (default mode): 161/161 (note: packages/lg under MBUI_TEST_MOTION=judge MBUI_TEST_FPS=60 has 4 pre-existing unrelated failures already present on main)

@CommaBot
CommaBot merged commit 58f3d31 into main Dec 6, 2026
3 checks passed
@CommaBot
CommaBot deleted the fix/glass-damped-drag-567-568 branch December 6, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants