Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Visuals::interact_cursor #3312

Merged
merged 5 commits into from
Sep 8, 2023
Merged

Conversation

zkldi
Copy link
Contributor

@zkldi zkldi commented Sep 5, 2023

When hovering over an egui::Button, the cursor should change to a PointingHand. This is consistent with the buttons in most other UIs (the browser, etc.)

Closes #3311.

@emilk
Copy link
Owner

emilk commented Sep 6, 2023

This should be opt-in, set as an option in Visuals.

I personally prefer pointing-hand to mean "clicking here will bring you someplace else", which not all buttons do, but of course this is a matter of preference.

You should also consider if this should apply to other widgets too. Maybe you want anything that is clickable to have the pointing hand?

@zkldi
Copy link
Contributor Author

zkldi commented Sep 6, 2023

Makes sense to me. I'll look into making this a visual option and take a look at other clickable widgets in egui. Should be committed by the end of the day.

Thanks for such a fast review!

@LoganDark
Copy link
Contributor

#3311 (comment)

this is a web browser thing that absolutely does not belong on native controls! leave this up to the user please and do NOT use the pointing hand cursor by default. maybe a setting would be reasonable but not a default

@zkldi
Copy link
Contributor Author

zkldi commented Sep 7, 2023

Sounds good to me! I'm putting this into an option now.

@zkldi
Copy link
Contributor Author

zkldi commented Sep 7, 2023

This is now an option that is off by default. From what I can tell browsers don't invoke this behaviour when hovering over a checkbox or a radio button. It's just for normal buttons.

There's an argument to be made that things like collapsing_header should also inherit this behaviour, since they're button-ish (vscode would agree with me here, but things like <summary> disagree.)


pointinghand_if_interactive is quite frankly a terrible name but I couldn't think of a better one. Totally open for any suggestions that suck less.

@LoganDark
Copy link
Contributor

LoganDark commented Sep 7, 2023

It's just for normal buttons.

Nope - it's only for hyperlinks. Sites override this for buttons, but for desktop UI elements this isn't common.

pointinghand_if_interactive is quite frankly a terrible name but I couldn't think of a better one. Totally open for any suggestions that suck less.

interact_cursor (or something like) and have it be an Option that can contain any cursor one would like?

@zkldi
Copy link
Contributor Author

zkldi commented Sep 7, 2023

Nope - it's only for hyperlinks. Sites override this for buttons, but for desktop UI elements this isn't common.

Oh wow, yea. Everything I checked this on overrides that functionality. I guess I've just subconsciously gotten used to it and thought it was the default.

interact_cursor (or something like) and have it be an Option that can contain any cursor one would like?

Yeah this is a huge improvement. One sec.

@emilk emilk added the egui label Sep 8, 2023
@emilk emilk merged commit 523aa6b into emilk:master Sep 8, 2023
18 of 19 checks passed
@emilk emilk changed the title feat: change to PointingHand when hovering over a button Add Visuals::interact_cursor Sep 27, 2023
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.

Should egui::Buttons change the cursor to PointingHand on hover?
3 participants