From 54782ea0bf9b1665a928342218cd9d35743af7c7 Mon Sep 17 00:00:00 2001 From: zxkmm Date: Sat, 12 Apr 2025 12:25:56 +0800 Subject: [PATCH] fine tune --- firmware/application/ui/ui_spectrum.cpp | 8 ++++++-- firmware/application/ui/ui_spectrum.hpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/firmware/application/ui/ui_spectrum.cpp b/firmware/application/ui/ui_spectrum.cpp index 9cbd0f3d5..ccda63ea7 100644 --- a/firmware/application/ui/ui_spectrum.cpp +++ b/firmware/application/ui/ui_spectrum.cpp @@ -306,7 +306,7 @@ void WaterfallWidget::on_channel_spectrum( bool WaterfallWidget::on_touch(const TouchEvent event) { if (event.type == TouchEvent::Type::Start) { if (on_touch_select) { - on_touch_select(event.point.x()); + on_touch_select(event.point.x(), event.point.y()); } } return true; @@ -331,7 +331,11 @@ WaterfallView::WaterfallView(const bool cursor) { if (on_select) on_select(offset); }; - waterfall_widget.on_touch_select = [this](int32_t x) { + waterfall_widget.on_touch_select = [this](int32_t x, int32_t y) { + if (y > screen_height - screen_height * 0.1) return; // prevent ghost touch + + frequency_scale.focus(); // focus on frequency scale to show cursor + if (sampling_rate) { // screen x to frequency scale x, NB we need two widgets align int32_t cursor_position = x - (screen_width / 2); diff --git a/firmware/application/ui/ui_spectrum.hpp b/firmware/application/ui/ui_spectrum.hpp index 984ad31e5..08ec85b18 100644 --- a/firmware/application/ui/ui_spectrum.hpp +++ b/firmware/application/ui/ui_spectrum.hpp @@ -114,7 +114,7 @@ class FrequencyScale : public Widget { class WaterfallWidget : public Widget { public: - std::function on_touch_select{}; + std::function on_touch_select{}; Gradient gradient{};