Disable hover effects when mouse leaves window.
This commit is contained in:
parent
6a7843f314
commit
a72f416650
@ -39,6 +39,10 @@ func (b *ControlBase) Handle(ctx *Context, event sdl.Event) {
|
||||
if b.IsMouseOver && e.Button == sdl.BUTTON_LEFT && e.Type == sdl.MOUSEBUTTONDOWN {
|
||||
b.Invoke(ctx, b.OnLeftMouseButtonClick)
|
||||
}
|
||||
case *sdl.WindowEvent:
|
||||
if e.Event == sdl.WINDOWEVENT_LEAVE {
|
||||
b.IsMouseOver = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,11 @@ func (r *terrainRenderer) Handle(ctx *Context, event sdl.Event) {
|
||||
r.project.update(ctx.Renderer)
|
||||
}
|
||||
}
|
||||
case *sdl.WindowEvent:
|
||||
if e.Event == sdl.WINDOWEVENT_LEAVE {
|
||||
r.hover = nil
|
||||
r.project.update(ctx.Renderer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user