From 0fa45e786d96d142062ffaf42ffc8d2dff5c66cb Mon Sep 17 00:00:00 2001 From: root Date: Sat, 23 May 2026 14:56:41 +0530 Subject: [PATCH] fix nav drawer gesture on all screens (#43) Move touch handling so left-edge swipe opens the navigation drawer on Settings, About, and Debug Log screens, not just the home screen. - Added BusKillNavigationDrawer subclass in buskill_gui.py that grabs left-edge touches before dispatching to child screens - Updated buskill.kv to use BusKillNavigationDrawer instead of NavigationDrawer - Fixed on_touch_down in garden.navigationdrawer to guard _main_panel touch dispatch with col_main check --- src/buskill.kv | 4 +-- src/buskill_gui.py | 35 +++++++++++++++++++ .../garden/navigationdrawer/__init__.py | 3 +- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/buskill.kv b/src/buskill.kv index 066e09b0..c1ac8a29 100644 --- a/src/buskill.kv +++ b/src/buskill.kv @@ -7,7 +7,7 @@ # Updated: 2023-06-14 # Version: 0.3 ################################################################################ - +#:import BusKillNavigationDrawer buskill_gui : @@ -64,7 +64,7 @@ title: '[font=RobotoMedium][size=20] BusKill[/size][/font]' on_release: root.toggle_menu() - NavigationDrawer: + BusKillNavigationDrawer: id: nav_drawer anim_type: 'slide_above_simple' side_panel_width: min( dp(300), 0.8*self.width ) diff --git a/src/buskill_gui.py b/src/buskill_gui.py index f934004f..161f4ffb 100755 --- a/src/buskill_gui.py +++ b/src/buskill_gui.py @@ -89,6 +89,41 @@ def get_screen_manager(obj): return None +class BusKillNavigationDrawer(NavigationDrawer): + """Fixes issue #43: nav drawer swipe gesture works on all screens. + + Root cause: Kivy dispatches on_touch_down to children first. Child + screens (Settings, DebugLog, etc.) consume the touch before the + NavigationDrawer can detect the left-edge swipe gesture. + + Fix: grab left-edge touches before dispatching to children. + """ + + def on_touch_down(self, touch): + if not self.collide_point(*touch.pos): + return super().on_touch_down(touch) + + if self._anim_progress < 0.001: + if touch.x <= self.touch_accept_width: + self._touch = touch + touch.grab(self) + self._start_touch_x = touch.x + self._start_time = touch.time_start + super().on_touch_down(touch) + return True + + return super().on_touch_down(touch) + + def on_touch_move(self, touch): + if touch.grab_current is self: + return super().on_touch_move(touch) + return super().on_touch_move(touch) + + def on_touch_up(self, touch): + if touch.grab_current is self: + return super().on_touch_up(touch) + return super().on_touch_up(touch) + class MainWindow(Screen): toggle_btn = ObjectProperty(None) diff --git a/src/packages/garden/navigationdrawer/__init__.py b/src/packages/garden/navigationdrawer/__init__.py index 5bf75fd7..1bfdfa22 100644 --- a/src/packages/garden/navigationdrawer/__init__.py +++ b/src/packages/garden/navigationdrawer/__init__.py @@ -515,7 +515,8 @@ def on_touch_down(self, touch): touch.x <= (self.x + self.touch_accept_width)) if not valid_region: - self._main_panel.on_touch_down(touch) + if col_main: + self._main_panel.on_touch_down(touch) return False else: if col_side and not self._main_above: