Open
Description
Description
When touching the screen, the circles are drawn at the opposite location of the touch input. For example, if I touch the top-left corner, the circle appears in the bottom-right corner. It seems like the x
and y
coordinates are being mirrored.
Steps to reproduce
- Run the provided demo code on an ESP32 with a CYD touchscreen.
- Touch anywhere on the display.
- Observe that the circle is drawn in the opposite location from where you touched.
Expected behavior
The circle should appear where the screen is touched, without mirroring the coordinates.
Code causing the issue
The following lines seem to be the cause of the mirroring:
y = (cyd.display.height - 1) - y
x = (cyd.display.width - 1) - x
Suggested fix:
Remove the mirroring and only ensure the circles are drawn within the screen boundaries:
y = min(max(y, r+1), cyd.display.height - r - 1)
x = min(max(x, r+1), cyd.display.width - r - 1)
Metadata
Metadata
Assignees
Labels
No labels