-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix hovering on toggled link and texture buttons #22780
Fix hovering on toggled link and texture buttons #22780
Conversation
dc8cc8a
to
cac1d40
Compare
Wouldn't it be cleaner to move the check for HOVER_PRESSED above the check for PRESSED and just not break? |
cac1d40
to
e048086
Compare
Yes you're right @dualmatrix. I just changed my commit. |
So I looked back to #22384 where I added the HOVER_PRESSED mode and I'm unsure this is the best solution. IMO HOVER_PRESSED should't even be called when Pressed automatically implies Hovering like in regular Buttons. I thought this was already the case but apperenlty I implemented it a bit differently. I think I should move the check that tests whether hover_pressed is possible to where the notification in sent ,not where it is recieved. This would be the cleaner solution I think. What do you think? |
I suppose it depends if we want to allow a "hover pressed texture" for TextureButtons in the future (I think it could make sense). If so, I think we can leave it like this. If not, I think you're right, the notification shouldn't even get there. What do you think? |
The same bug likely happens in |
fix hovering on toggled link buttons
e048086
to
cf2bdcb
Compare
You're right, I tested it with the "Font Color Hover" and "Font Color Pressed" properties and it is happening. I've updated the PR title and commit (although @dualmatrix may come with a better solution). |
If it makes sense (I think it does) to have this "hover pressed" functionality for |
@samuelpedrajas I don't see how HOVER_PRESSED makes sense for regular buttons, since it being pressed automatically means it's being hovered over at the same time right? |
@dualmatrix If |
@samuelpedrajas Oh, I wasn't aware of that, in that case the HOVER_PRESSED functionallity should probably be extended to all buttons that offer that mode |
Came here from an issue relating to this bug... It solves the bug, but Should there not be an option to add a texture for HOVER_PRESSED, and have it default to the PRESSED texture if not defined? |
@JaLu1 Agreed yeah, thats also what I had in mind |
the entire switch statement can be reworked to be more efficient, working on that now |
Alright, I rebuilt the structure of the switch statement so it is cleaner and includes support for the extra texture. Can I add to the fork? |
I'll merge this for now, if you have a reworked version for the |
It seems that DRAW_HOVER_PRESSED introduced a small bug in the TextureButton class. When one of these buttons is toggled (toggle mode being active) the button disappears when the mouse is over it.
Steps
I basically copied the code from the DRAW_HOVER case to the DRAW_HOVER_PRESSED one and removed the
if (hover.is_null())
conditional. Let me know if this is the right way to do it!