Skip to content

Enable mouse wheel scrolling while dragging inside a ScrollArea#7919

Open
rustbasic wants to merge 1 commit intoemilk:mainfrom
rustbasic:patch171
Open

Enable mouse wheel scrolling while dragging inside a ScrollArea#7919
rustbasic wants to merge 1 commit intoemilk:mainfrom
rustbasic:patch171

Conversation

@rustbasic
Copy link
Copy Markdown
Contributor

Enable mouse wheel scrolling while dragging inside a ScrollArea

Problem

When the pointer button is held down and a widget inside a ScrollArea is being dragged (e.g. selecting text in TextEdit), mouse wheel scrolling does not work. This happens because ScrollArea only processes mouse wheel scrolling when ctx.dragged_id().is_none(), i.e. when no widget is currently being dragged.

Change

Relax the wheel-scrolling gating condition so that wheel scrolling is allowed whenever the pointer is over the scroll area (or when background-drag scrolling is active), even if another widget is currently being dragged.

Concretely, we replace the dragged_id().is_none() requirement for the mouse wheel path with:

  • pointer_over_outer = ui.rect_contains_pointer(outer_rect) || is_dragging_background
  • Use pointer_over_outer to decide whether to apply wheel scrolling

Result

  • Wheel scrolling works while dragging/selecting within widgets inside a ScrollArea (notably TextEdit).
  • This matches common desktop editor behavior: drag-select while wheel-scrolling to extend selection.

Notes / Potential behavior change

This enables wheel scrolling during any active drag (not only TextEdit), as long as the pointer is over the ScrollArea. If maintainers prefer limiting this to specific widgets (e.g. only text selection), we can follow up with a more targeted approach (e.g. an explicit option/flag).

Files changed

  • scroll_area.rs (wheel scrolling hover gating logic)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 17, 2026

Preview available at https://egui-pr-preview.github.io/pr/7919-patch171
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant