-
Notifications
You must be signed in to change notification settings - Fork 1.3k
tilegrid.contains() function #6442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor nitpicks. Thanks for adding this! Group would be cool to do too.
Co-authored-by: Scott Shawcroft <[email protected]>
Thank you! latest commits make those changes. I retested it successfully on PyPortal Titano with this code:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
One more commit to fix an off by 1 error. Turns out the right and bottom edges were returning True for one pixel too large. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you!
This adds a
tilegrid.contains()
function that accepts a touch tuple from adafruit_touchscreen library (or similar) and returns true or false based on whether the touch point is inside the rectangular bounds of this tilegrid.This function matches the API provided by the display button library: https://github.com/adafruit/Adafruit_CircuitPython_Display_Button
This will allow us to use arbitrary Bitmaps and OnDiskBitmaps as touch interactive objects.