From 3d8d2a80a6a6a09cc4e122ab7c441261618e46b7 Mon Sep 17 00:00:00 2001 From: Michael Werle Date: Wed, 20 Nov 2024 00:57:27 +0900 Subject: [PATCH] feat(radar): enable clicking on zoom mode indicator Use the zoom mode indicator to also toggle between automatic and manual zoom modes for the 3D radar. --- data/pigui/modules/radar.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/data/pigui/modules/radar.lua b/data/pigui/modules/radar.lua index fbb237bdcd..4b068030ea 100644 --- a/data/pigui/modules/radar.lua +++ b/data/pigui/modules/radar.lua @@ -367,7 +367,15 @@ local function displayRadar() ui.sameLine() ui.addCursorPos(Vector2(0, toggle_button_size - button_size)) icon = instrument:isAutoZoom() and icons.radar_automatic or icons.radar_manual - ui.mainMenuButton(icon, tt, ui.theme.buttonColors.disabled, Vector2(button_size)) + local theme = instrument:isAutoZoom() and ui.theme.buttonColors.disabled or ui.theme.buttonColors.default + local clicked = ui.mainMenuButton(icon, tt, theme, Vector2(button_size)) + if clicked then + if instrument:isAutoZoom() then + instrument:zoomIn() + else + instrument:resetZoom() + end + end end -- Draw radar range