From c603d07012c76cd59afbcc1358f5bc628f5970ed Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 1 May 2026 00:26:02 -0400 Subject: [PATCH] fix(mici/onroad): suppress click on outer drag and bookmark gesture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OnroadViewContainerSP nests a vertical scroller between the outer horizontal scroller and road_view/info_panel. Stock click suppression relies on a child's _touch_valid_callback being gated by its parent scroll panel — with the container in the middle, children were only gated by the inner panel, so an outer L→R drag never invalidated their touch and the click fired on release (immediately popping to home). - Chain children's touch_valid through the container's own touch_valid so outer-scroll state propagates to nested children. - Add OnroadInfoPanel._handle_mouse_release mirroring AugmentedRoadView's bookmark guard, so an R→L bookmark drag on the info panel doesn't fire the click on release. --- selfdrive/ui/sunnypilot/mici/layouts/onroad.py | 10 ++++++++++ .../ui/sunnypilot/mici/layouts/onroad_info_panel.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/selfdrive/ui/sunnypilot/mici/layouts/onroad.py b/selfdrive/ui/sunnypilot/mici/layouts/onroad.py index f09b6a8693..ca1b839756 100644 --- a/selfdrive/ui/sunnypilot/mici/layouts/onroad.py +++ b/selfdrive/ui/sunnypilot/mici/layouts/onroad.py @@ -28,6 +28,16 @@ class OnroadViewContainerSP(ScrollerSP): self._scroller.set_reset_scroll_at_show(False) self._scroller.set_scrolling_enabled(lambda: abs(self.rect.x) < HORIZONTAL_SETTLE_PX) + # Inner scroller wraps children's touch_valid via inner panel only. Chain + # container's own touch_valid (already wrapped by outer scroller) so an + # outer-scroll drag invalidates child touches and suppresses the click — + # matches stock behavior when road_view is a direct outer child. + for child in (self.road_view, self.onroad_info_panel): + inner_touch_valid = child._touch_valid_callback + child.set_touch_valid_callback( + lambda inner=inner_touch_valid: self._touch_valid() and (inner() if inner else True) + ) + def set_rect(self, rect: rl.Rectangle): super().set_rect(rect) self.road_view.set_rect(rect) diff --git a/selfdrive/ui/sunnypilot/mici/layouts/onroad_info_panel.py b/selfdrive/ui/sunnypilot/mici/layouts/onroad_info_panel.py index e51b256868..c51b8c5f41 100644 --- a/selfdrive/ui/sunnypilot/mici/layouts/onroad_info_panel.py +++ b/selfdrive/ui/sunnypilot/mici/layouts/onroad_info_panel.py @@ -13,6 +13,7 @@ from openpilot.selfdrive.ui.ui_state import ui_state from openpilot.system.ui.lib.application import gui_app, FontWeight from openpilot.system.ui.lib.multilang import tr from openpilot.system.ui.lib.text_measure import measure_text_cached +from openpilot.system.ui.lib.application import MousePos from openpilot.system.ui.widgets import Widget from openpilot.selfdrive.ui.mici.onroad.alert_renderer import AlertRenderer from openpilot.selfdrive.ui.mici.onroad.augmented_road_view import BookmarkIcon @@ -71,6 +72,11 @@ class OnroadInfoPanel(Widget): def is_swiping_left(self) -> bool: return self._bookmark_icon.is_swiping_left() + def _handle_mouse_release(self, mouse_pos: MousePos) -> None: + # Mirror stock AugmentedRoadView: suppress click while bookmark gesture active + if not self._bookmark_icon.interacting(): + super()._handle_mouse_release(mouse_pos) + def _update_state(self) -> None: sm = ui_state.sm speed_conv = CV.MS_TO_KPH if ui_state.is_metric else CV.MS_TO_MPH