You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
only trigger right swipe when released
This commit is contained in:
@@ -104,7 +104,10 @@ class SettingsScreen():
|
||||
def open_edit_popup(self, setting):
|
||||
# Close existing msgbox and keyboard if open
|
||||
if self.msgbox:
|
||||
self.msgbox.delete()
|
||||
try:
|
||||
self.msgbox.delete()
|
||||
except Exception as e:
|
||||
print(f"Warning: could not delete msgbox: {e}")
|
||||
self.msgbox = None
|
||||
if self.keyboard:
|
||||
self.keyboard.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
|
||||
@@ -69,6 +69,12 @@ def swipe_read_cb(indev_drv, data):
|
||||
mpos.ui.open_drawer()
|
||||
start_y = None # Reset Y after swipe
|
||||
start_x = None # Reset X to avoid conflicts
|
||||
else:
|
||||
# Mouse/touch released
|
||||
if start_y is not None and y < start_y - 50: # Threshold for swipe-up
|
||||
print("Swipe Up Detected")
|
||||
mpos.ui.close_drawer()
|
||||
|
||||
# Check for rightward swipe from left edge (x increased significantly)
|
||||
if start_x is not None and x > start_x + 50: # Threshold for swipe right
|
||||
print("Long swipe right")
|
||||
@@ -77,11 +83,6 @@ def swipe_read_cb(indev_drv, data):
|
||||
mpos.ui.back_screen() # Call custom method for left menu
|
||||
start_y = None # Reset Y after swipe
|
||||
start_x = None # Reset X after swipe
|
||||
else:
|
||||
# Mouse/touch released
|
||||
if start_y is not None and y < start_y - 50: # Threshold for swipe-up
|
||||
print("Swipe Up Detected")
|
||||
mpos.ui.close_drawer()
|
||||
|
||||
# Reset both coordinates on release
|
||||
start_y = None
|
||||
|
||||
Reference in New Issue
Block a user