Skip to content

Conversation

@multiplex55
Copy link
Owner

Motivation

  • Allow widget content to overflow horizontally as well as vertically so wide widget bodies can be scrolled instead of clipped.
  • Preserve the previous vertical height constraint behavior by keeping the scroll area height limited to body_height.
  • Ensure slot clipping still enforces slot bounds while permitting horizontal scrolling inside the slot via the existing clip-rect intersection.
  • Add tests to validate both-axis scrolling behavior and record scroll viewport information for assertions.

Description

  • Replaced egui::ScrollArea::vertical() with egui::ScrollArea::both() and retained .auto_shrink([false; 2]) and .max_height(body_height) so vertical height is constrained while horizontal overflow is allowed.
  • Kept ui.set_clip_rect(ui.clip_rect().intersect(slot_clip)) to ensure slot bounds are respected while allowing horizontal scrolling within the slot.
  • Added test instrumentation SCROLL_VIEWPORTS and OVERFLOW_RECORDS, an OverflowWidget test widget, overflow_registry, and helper functions take_scroll_viewports() / take_overflow_records() to capture viewport and allocated content rectangles.
  • Added a unit test scroll_area_allows_horizontal_and_vertical_overflow which renders an oversized widget and asserts that the painted/allocated rect is larger than the scroll viewport and that scrollbars are exposed as expected.

Testing

  • Added the unit test scroll_area_allows_horizontal_and_vertical_overflow to cover two-axis overflow behavior.
  • Existing unit tests were left intact and continue to record scroll visibility via SCROLL_VISIBILITY_RECORDS.
  • No automated test run was performed as part of this change (cargo test was not executed in this rollout).
  • Manual code compilation / CI is recommended to verify the new test and existing test-suite pass.

Codex Task

@multiplex55 multiplex55 merged commit 9190822 into master Jan 9, 2026
1 check passed
@multiplex55 multiplex55 deleted the codex/update-scroll-behavior-in-dashboard-widget branch January 11, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants