Skip to content

Commit

Permalink
Button States
Browse files Browse the repository at this point in the history
  • Loading branch information
exussum12 authored Jan 7, 2025
1 parent 5b2a103 commit ba6d507
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions modules/py_frozen/touch.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,9 @@ def _handle_touch(self, pin):
print(self.x, self.y, self.x2, self.y2, self.distance, self.angle, self.state, self.state2)

for button in Button.buttons:
if self.state:
if self.x >= button.x and self.x <= button.x + button.w and self.y >= button.y and self.y <= button.y + button.h:
button.pressed = True
elif self.x2 >= button.x and self.x2 <= button.x + button.w and self.y2 >= button.y and self.y2 <= button.y + button.h:
button.pressed = True
else:
button.pressed = False
if self.state and self.x >= button.x and self.x <= button.x + button.w and self.y >= button.y and self.y <= button.y + button.h:
button.pressed = True
elif self.state2 and self.x2 >= button.x and self.x2 <= button.x + button.w and self.y2 >= button.y and self.y2 <= button.y + button.h:
button.pressed = True
else:
button.pressed = False

0 comments on commit ba6d507

Please sign in to comment.