mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-25 14:50:37 +01:00
Increased MDSwitch hit zone
This commit is contained in:
parent
14cd17c54e
commit
5626342cbf
@ -137,9 +137,11 @@
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
on_touch_down:
|
||||
if self.collide_point(*args[1].pos) and not root.disabled: \
|
||||
root.on_thumb_down()
|
||||
on_touch_up:
|
||||
if self.collide_point(*args[1].pos) and not root.disabled: \
|
||||
setattr(root, "active", not root.active)
|
||||
if self.collide_point(*args[1].pos) and not root.disabled: setattr(root, "active", not root.active)
|
||||
elif root.collide_point(*args[1].pos) and not root.disabled: setattr(root, "active", not root.active)
|
||||
else: root.tnn(args[1])
|
||||
|
@ -829,6 +829,23 @@ class MDSwitch(ThemableBehavior, FloatLayout):
|
||||
Clock.schedule_once(lambda x: self._update_thumb_pos(animation=False))
|
||||
Clock.schedule_once(lambda x: self.on_active(self, self.active))
|
||||
|
||||
# Hack to increase switch hit zone
|
||||
def tnn(self, pa):
|
||||
try:
|
||||
ex = pa.pos[0]
|
||||
ey = pa.pos[1]
|
||||
xs = self.center[0]-self.width/2 - (self.width)
|
||||
xe = self.center[0]+self.width/2 + (self.width)
|
||||
ys = self.center[1]-self.height/2
|
||||
ye = self.center[1]+self.height/2
|
||||
|
||||
# print(str(xs)+" < "+str(ex)+" < "+str(xe)+" "+str(ys)+" < "+str(ey)+" < "+str(ye))
|
||||
if xs < ex < xe and ys < ey < ye:
|
||||
self.active = not self.active
|
||||
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
def set_icon(self, instance_switch, icon_value: str) -> None:
|
||||
"""
|
||||
Called when the values of
|
||||
|
Loading…
Reference in New Issue
Block a user