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

Ui does not properly handle mouse-out from the ui itself. #1130

Open
IceReaper opened this issue Aug 28, 2021 · 0 comments
Open

Ui does not properly handle mouse-out from the ui itself. #1130

IceReaper opened this issue Aug 28, 2021 · 0 comments
Labels
area-UI bug Something isn't working

Comments

@IceReaper
Copy link

When the mouse leaves the ui, the mouse-out event is not processed.
This can be seen here:
https://github.com/stride3d/stride/blob/master/sources/engine/Stride.UI/Rendering/UI/UIRenderFeature.Picking.cs#L249
Basically if the mouse is not within the bounds, the mouse is not handled. While this is correct theoretically, it will also skip invoking the mouse out event for the currently hovered element, leaving it in the hovered state.

This can be seen here:
Animation

A hacked workaround is this:

        protected override bool BeginDraw()
        {
            this.uiRenderFeature ??= this.SceneSystem.GraphicsCompositor.RenderFeatures.OfType<UIRenderFeature>().FirstOrDefault();
            this.uiElementUnderMouseCursor = this.uiRenderFeature?.UIElementUnderMouseCursor;

            return base.BeginDraw();
        }

        protected override void EndDraw(bool present)
        {
            if (this.uiElementUnderMouseCursor != null && this.uiRenderFeature?.UIElementUnderMouseCursor == null)
                this.uiElementUnderMouseCursor?.GetType().GetProperty("MouseOverState")?.SetValue(this.uiElementUnderMouseCursor, MouseOverState.MouseOverNone);
            
            base.EndDraw(present);
        }
@IceReaper IceReaper added the bug Something isn't working label Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-UI bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants