From 830ec00e0d242d6d509c7cc8f0d70dec8c3b7bb0 Mon Sep 17 00:00:00 2001 From: darkfi Date: Thu, 8 Aug 2024 15:17:29 +0200 Subject: [PATCH] wallet: ignore touch events outside widget rects --- bin/darkwallet/src/ui/button.rs | 8 ++++++++ bin/darkwallet/src/ui/chatview.rs | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/bin/darkwallet/src/ui/button.rs b/bin/darkwallet/src/ui/button.rs index bb9f51c05..010279758 100644 --- a/bin/darkwallet/src/ui/button.rs +++ b/bin/darkwallet/src/ui/button.rs @@ -199,6 +199,14 @@ impl Button { if id != 0 { return } + + let Some(rect) = self.get_cached_rect() else { return }; + let touch_pos = Point { x: touch_x, y: touch_y }; + if !rect.contains(&touch_pos) { + //debug!(target: "ui::chatview", "not inside rect"); + return + } + // Simulate mouse events match phase { TouchPhase::Started => self.handle_mouse_btn_down(MouseButton::Left, touch_x, touch_y), diff --git a/bin/darkwallet/src/ui/chatview.rs b/bin/darkwallet/src/ui/chatview.rs index ff4e12a3e..ed10a4ce9 100644 --- a/bin/darkwallet/src/ui/chatview.rs +++ b/bin/darkwallet/src/ui/chatview.rs @@ -588,6 +588,14 @@ impl ChatView { if id != 0 { return } + + let Some(rect) = self.get_cached_world_rect().await else { return }; + let touch_pos = Point { x: touch_x, y: touch_y }; + if !rect.contains(&touch_pos) { + //debug!(target: "ui::chatview", "not inside rect"); + return + } + // Simulate mouse events match phase { TouchPhase::Started => {