fix(renderer): only send non-empty layer hit messages

This commit is contained in:
Ayman Bagabas 2025-06-27 12:41:23 -04:00
parent 9b921df874
commit 73b42b864e
No known key found for this signature in database
GPG key ID: C8D51D2157C919AC

View file

@ -262,11 +262,12 @@ func (s *cursedRenderer) hit(mouse MouseMsg) []Msg {
if s.layer != nil {
if h, ok := s.layer.(Hittable); ok {
m := mouse.Mouse()
id := h.Hit(m.X, m.Y)
return []Msg{LayerHitMsg{
ID: id,
Mouse: mouse,
}}
if id := h.Hit(m.X, m.Y); id != "" {
return []Msg{LayerHitMsg{
ID: id,
Mouse: mouse,
}}
}
}
}