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

early out in should_show_hover_ui() #5108

Closed
wants to merge 1 commit into from

Conversation

rustbasic
Copy link
Contributor

should_show_hover_ui() only works on hover, so it's better to come out early.
Is there something different from what you intended or is there a problem?

@lucasmerlin
Copy link
Collaborator

lucasmerlin commented Sep 19, 2024

I think this is already handled in line 720:

        // Fast early-outs:
        if self.enabled {
            if !self.hovered || !self.ctx.input(|i| i.pointer.has_pointer()) {
                return false;
            }
        } else if !self.ctx.rect_contains_pointer(self.layer_id, self.rect) {
            return false;
        }

And I believe the reason the check is only done if self.enabled is that otherwise on_disabled_hover_ui wouldn't work, because things that aren't enabled don't get the hover event, but I'm not 100% sure.

You can try creating a disabled element with your changes and try if the on_disabled_hover_ui still works

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.

2 participants