Repository navigation
feat(scroll): implement smooth mouse-wheel scrolling & viewport clamping - #14
Merged
Merged
Conversation
…mping (#3) - Add target_scroll_y and scroll_velocity fields to Tab for smooth momentum scrolling - Implement apply_wheel_delta, tick_scroll (lerp interpolation & velocity decay), and clamp_scroll - Add total_document_height on LayoutBox to determine maximum scrollable viewport boundary - Intercept WindowEvent::MouseWheel handling LineDelta and PixelDelta in main event loop - Advance scroll easing and request follow-up redraw frames on RedrawRequested - Add 7 automated unit tests for scroll bounds, lerp settling, and velocity decay - Update ROADMAP.md tracking and test suite count - Closes #3
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
Resolves #3 by introducing smooth mouse-wheel scrolling with momentum easing, viewport boundary clamping, and total document height calculation.
Key Changes
target_scroll_yandscroll_velocitytoTabto track inertia and target offsets.apply_wheel_delta(),tick_scroll()(with friction decay and lerp easing toward target), andclamp_scroll()insrc/ui/tab.rs.LayoutBox::total_document_height()insrc/layout/tree.rsto measure the complete rendered page height.WindowEvent::MouseWheel(supporting bothLineDeltaandPixelDelta) insrc/main.rs, computing dynamicmax_scroll = (document_height - viewport_height).max(0.0).tick_scroll()intoWindowEvent::RedrawRequestedto request continuous redraw frames until velocity settles.src/ui/tab.rsverifying clamp bounds, lerp progression, settling conditions, velocity decay, and navigation reset.Closes #3.