diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-05 18:32:36 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-05 18:33:35 +0200 |
| commit | 60639e7a83bf4f22c3a3ccfab56921b88ff81c4f (patch) | |
| tree | 6b87014b368928e8be56981e47d4b6a5229e6b2a /go/ui | |
| parent | 04476b3225158a244269a84f0dcf112cfd0ee05a (diff) | |
| download | muhqs-game-60639e7a83bf4f22c3a3ccfab56921b88ff81c4f.tar.gz muhqs-game-60639e7a83bf4f22c3a3ccfab56921b88ff81c4f.zip | |
only clear tile highlights added by the hover perm info on HoverEnd
Diffstat (limited to 'go/ui')
| -rw-r--r-- | go/ui/hoverable.go | 5 | ||||
| -rw-r--r-- | go/ui/mapView.go | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/go/ui/hoverable.go b/go/ui/hoverable.go index 08fd9240..ea80b51e 100644 --- a/go/ui/hoverable.go +++ b/go/ui/hoverable.go @@ -2,6 +2,7 @@ package ui import ( "image/color" + "muhq.space/muhqs-game/go/game" ) @@ -111,7 +112,9 @@ func (h *hoverPermInfo) init(mv *MapView, c *Collection) { } h.reset = func() { - mv.ClearTileHighlights() + for _, t := range movable { + mv.ClearTileHighlight(t) + } } } diff --git a/go/ui/mapView.go b/go/ui/mapView.go index 035f0f35..169aaaf3 100644 --- a/go/ui/mapView.go +++ b/go/ui/mapView.go @@ -473,6 +473,13 @@ func (vw *MapView) AddHighlightTile(t *game.Tile, color color.Color) { vw.AddHighlightPosition(t.Position, color) } +// ClearTileHighlight removes a tile from the highlighted ones. +func (vw *MapView) ClearTileHighlight(t *game.Tile) { + delete(vw.tileHighlights, t.Position) + vw.ForceRedraw() +} + +// ClearTileHighlights removes all tile highlights. func (vw *MapView) ClearTileHighlights() { vw.HighlightTiles([]*game.Tile{}, nil) } |
