fine tune

This commit is contained in:
zxkmm 2025-04-12 12:25:56 +08:00
parent d792ed04e2
commit 54782ea0bf
2 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -114,7 +114,7 @@ class FrequencyScale : public Widget {
class WaterfallWidget : public Widget {
public:
std::function<void(int32_t offset)> on_touch_select{};
std::function<void(int32_t offset, int32_t y)> on_touch_select{};
Gradient gradient{};