Fix: Visuals::interact_cursor support in Button#7986
Merged
emilk merged 4 commits intoemilk:mainfrom Mar 25, 2026
Merged
Conversation
The `Visuals::interact_cursor` support was accidentally dropped from `Button` in commit 6eb7bb6 when the widget was rewritten to use `AtomLayout`. This restores the original behavior so that setting `interact_cursor` (e.g. to `CursorIcon::PointingHand`) actually changes the cursor when hovering over buttons again. Closes emilk#7947
|
Preview available at https://egui-pr-preview.github.io/pr/7986-fixinteract-cursor-regression View snapshot changes at kitdiff |
emilk
reviewed
Mar 24, 2026
Visuals::interact_cursor support in Button
Masterchef365
pushed a commit
to Masterchef365/egui
that referenced
this pull request
Apr 3, 2026
Closes emilk#7947 ## Problem `Visuals::interact_cursor` stopped working for buttons after the `AtomLayout` refactor in commit 6eb7bb6. Setting `interact_cursor` to e.g. `CursorIcon::PointingHand` no longer changes the cursor when hovering over a `Button`. ## Root Cause When `Button` was rewritten to use `AtomLayout` in emilk#5830, the cursor-override block at the end of the old `Button::ui` was not carried over to the new `Button::atom_ui` method. The old code had: ```rust if let Some(cursor) = ui.visuals().interact_cursor { if response.hovered() { ui.ctx().set_cursor_icon(cursor); } } ``` This was the only place `interact_cursor` was checked, so the setting became entirely non-functional. ## Fix Re-add the same `interact_cursor` check in `Button::atom_ui`, right after painting and before `widget_info`, matching the original behavior. --------- Co-authored-by: easonysliu <[email protected]> Co-authored-by: Emil Ernerfeldt <[email protected]>
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.
Closes #7947
Problem
Visuals::interact_cursorstopped working for buttons after theAtomLayoutrefactor in commit 6eb7bb6. Settinginteract_cursorto e.g.CursorIcon::PointingHandno longer changes the cursor when hovering over aButton.Root Cause
When
Buttonwas rewritten to useAtomLayoutin #5830, the cursor-override block at the end of the oldButton::uiwas not carried over to the newButton::atom_uimethod.The old code had:
This was the only place
interact_cursorwas checked, so the setting became entirely non-functional.Fix
Re-add the same
interact_cursorcheck inButton::atom_ui, right after painting and beforewidget_info, matching the original behavior.