only trigger right swipe when released

This commit is contained in:
Thomas Farstrike
2025-05-24 07:53:03 +02:00
parent 2dc3364a99
commit ea806a6bc3
2 changed files with 10 additions and 6 deletions
@@ -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)
+6 -5
View File
@@ -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