From 3cdb8a63039aa2cf426104ab02656996730f79fa Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Sat, 12 Apr 2025 21:12:06 +0200 Subject: [PATCH] show node on chat clicked (#117) --- include/graphics/view/TFT/TFTView_320x240.h | 1 + source/graphics/TFT/TFTView_320x240.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/graphics/view/TFT/TFTView_320x240.h b/include/graphics/view/TFT/TFTView_320x240.h index 7279488..8f7afa1 100644 --- a/include/graphics/view/TFT/TFTView_320x240.h +++ b/include/graphics/view/TFT/TFTView_320x240.h @@ -369,6 +369,7 @@ class TFTView_320x240 : public MeshtasticView static void ui_event_mapBrightnessSlider(lv_event_t *e); static void ui_event_mapContrastSlider(lv_event_t *e); static void ui_event_mapNodeButton(lv_event_t *e); + static void ui_event_chatNodeButton(lv_event_t *e); static void ui_event_positionButton(lv_event_t *e); // animations diff --git a/source/graphics/TFT/TFTView_320x240.cpp b/source/graphics/TFT/TFTView_320x240.cpp index 07f6ada..6318f8b 100644 --- a/source/graphics/TFT/TFTView_320x240.cpp +++ b/source/graphics/TFT/TFTView_320x240.cpp @@ -2209,6 +2209,19 @@ void TFTView_320x240::ui_event_mapNodeButton(lv_event_t *e) ui_event_NodeButton(e); } +void TFTView_320x240::ui_event_chatNodeButton(lv_event_t *e) +{ + uint32_t nodeNum = (unsigned long)e->user_data; + auto it = THIS->nodes.find(nodeNum); + if (it != THIS->nodes.end()) { + lv_obj_t *panel = it->second; + THIS->ui_set_active(objects.nodes_button, objects.nodes_panel, objects.top_nodes_panel); + lv_obj_scroll_to_view(panel, LV_ANIM_ON); + if (panel != currentPanel) + ui_event_NodeButton(e); + } +} + void TFTView_320x240::ui_event_positionButton(lv_event_t *e) { // navigate to position in map @@ -6118,6 +6131,7 @@ void TFTView_320x240::newMessage(uint32_t nodeNum, lv_obj_t *container, uint8_t lv_obj_scroll_to_view(hiddenPanel, LV_ANIM_ON); lv_obj_move_foreground(objects.message_input_area); + lv_obj_add_event_cb(hiddenPanel, ui_event_chatNodeButton, LV_EVENT_CLICKED, (void *)nodeNum); } /**