Remove one of the ugly RPi touch screen workarounds

This commit is contained in:
Admar Schoonen 2023-04-10 22:23:04 +02:00
parent e0a9074670
commit 6a23615f87
1 changed files with 11 additions and 13 deletions

View File

@ -979,21 +979,19 @@ class MyClockWidget(FloatLayout):
if len(self.light_button_move_init) == 0:
self.light_button_move_init = touch_curr.spos
# Ugly workaround for issue with Kivy and Raspberry Pi 3 + touch screen: ignore corrected touched
if touch_curr.corrected == False:
d = touch_curr.spos[0] - self.light_button_move_init[0]
threshold = 0.05
d = touch_curr.spos[0] - self.light_button_move_init[0]
threshold = 0.05
# Ugly workaround for issue with Kivy and Raspberry Pi 3 + touch screen: mirror d if position is on other side
if self.light_button_move_init[0] > 0.5:
d = -d
# Ugly workaround for issue with Kivy and Raspberry Pi 3 + touch screen: mirror d if position is on other side
if self.light_button_move_init[0] > 0.5:
d = -d
if d > 0.05:
# move to the right: set light to wake up level
self.light_state = "on"
elif d < -0.05:
# move to the left: set light off
self.light_state = "off"
if d > 0.05:
# move to the right: set light to wake up level
self.light_state = "on"
elif d < -0.05:
# move to the left: set light off
self.light_state = "off"
super(MyClockWidget, self).on_touch_move(touch)