diff --git a/modules/ui_shared/include/ui/screens/chat/chat_conversation_components.h b/modules/ui_shared/include/ui/screens/chat/chat_conversation_components.h index 262df3bd..937bab06 100644 --- a/modules/ui_shared/include/ui/screens/chat/chat_conversation_components.h +++ b/modules/ui_shared/include/ui/screens/chat/chat_conversation_components.h @@ -72,6 +72,7 @@ class ChatConversationScreen bool isReplyEnabled() const { return reply_enabled_; } void setLocationOverlay(const ::ui::map::MapOverlaySnapshot& overlay); void toggleLocationMap(); + void cycleLocationMapLayer(); bool isLocationMapVisible() const { return location_map_visible_; } private: diff --git a/modules/ui_shared/src/ui/screens/chat/chat_conversation_components.cpp b/modules/ui_shared/src/ui/screens/chat/chat_conversation_components.cpp index d33a8598..277399b1 100644 --- a/modules/ui_shared/src/ui/screens/chat/chat_conversation_components.cpp +++ b/modules/ui_shared/src/ui/screens/chat/chat_conversation_components.cpp @@ -663,6 +663,24 @@ void ChatConversationScreen::toggleLocationMap() syncLocationMapVisibility(); } +void ChatConversationScreen::cycleLocationMapLayer() +{ + if (!guard_ || !guard_->alive) + { + return; + } + + const auto layers = ::ui::widgets::map::current_layer_state(); + const uint8_t next_source = + static_cast((layers.map_source + 1U) % 3U); + (void)::ui::widgets::map::set_layer_map_source(next_source); + + if (location_map_visible_) + { + refreshLocationMap(); + } +} + bool ChatConversationScreen::usesFloatingLocationMap() const { #if defined(ARDUINO_T_DECK) || defined(ARDUINO_T_DECK_PRO) diff --git a/modules/ui_shared/src/ui/screens/chat/chat_conversation_input.cpp b/modules/ui_shared/src/ui/screens/chat/chat_conversation_input.cpp index ddaa6245..5f38cd7b 100644 --- a/modules/ui_shared/src/ui/screens/chat/chat_conversation_input.cpp +++ b/modules/ui_shared/src/ui/screens/chat/chat_conversation_input.cpp @@ -21,22 +21,28 @@ constexpr int kEncoderKeyRotateDown = 20; constexpr lv_coord_t kScrollStep = 24; } // namespace -static bool handle_location_key(ChatConversationScreen* screen, - lv_event_t* e, - uint32_t key) +static bool handle_map_key(ChatConversationScreen* screen, + lv_event_t* e, + uint32_t key) { - if (key != 'l' && key != 'L') - { - return false; - } if (!screen || !screen->isAlive()) { return false; } - screen->toggleLocationMap(); - lv_event_stop_processing(e); - return true; + if (key == 'm' || key == 'M') + { + screen->toggleLocationMap(); + lv_event_stop_processing(e); + return true; + } + if (key == 'l' || key == 'L') + { + screen->cycleLocationMapLayer(); + lv_event_stop_processing(e); + return true; + } + return false; } static void on_msg_list_key(lv_event_t* e) @@ -55,7 +61,7 @@ static void on_msg_list_key(lv_event_t* e) return; } - if (handle_location_key(screen, e, key)) + if (handle_map_key(screen, e, key)) { return; } @@ -99,7 +105,7 @@ static void on_backspace_key(lv_event_t* e) auto* screen = static_cast(lv_event_get_user_data(e)); if (!screen || !screen->isAlive()) return; uint32_t key = lv_event_get_key(e); - if (handle_location_key(screen, e, key)) + if (handle_map_key(screen, e, key)) { return; }