diff --git a/control.go b/control.go index 511ff95..3f2f513 100644 --- a/control.go +++ b/control.go @@ -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 + } } } diff --git a/terrainrenderer.go b/terrainrenderer.go index a084123..84495b7 100644 --- a/terrainrenderer.go +++ b/terrainrenderer.go @@ -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) + } } }