mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-08-28 13:34:07 +00:00
Adjust chat map shortcuts
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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<uint8_t>((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)
|
||||
|
||||
@@ -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<ChatConversationScreen*>(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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user