Fix issue with detouch being logged as touch at 0,0
This commit is contained in:
parent
be3aed6e5e
commit
e5e9f62e31
@ -76,6 +76,7 @@ class FT5xx6TouchDriver:
|
|||||||
self._initialized = False
|
self._initialized = False
|
||||||
self._last_num_touches = 0
|
self._last_num_touches = 0
|
||||||
self._tracking_touch = False
|
self._tracking_touch = False
|
||||||
|
self._last_touch_pos = (0, 0) # Track last known touch position for drag_end
|
||||||
|
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -206,6 +207,7 @@ class FT5xx6TouchDriver:
|
|||||||
# Handle single-touch gestures with our gesture detector
|
# Handle single-touch gestures with our gesture detector
|
||||||
if num_touches == 1:
|
if num_touches == 1:
|
||||||
x, y = record.t1x, record.t1y
|
x, y = record.t1x, record.t1y
|
||||||
|
self._last_touch_pos = (x, y) # Track position for drag_end
|
||||||
|
|
||||||
# Touch down
|
# Touch down
|
||||||
if self._last_num_touches == 0:
|
if self._last_num_touches == 0:
|
||||||
@ -233,10 +235,10 @@ class FT5xx6TouchDriver:
|
|||||||
elif num_touches == 0 and self._last_num_touches > 0:
|
elif num_touches == 0 and self._last_num_touches > 0:
|
||||||
# Get last known position
|
# Get last known position
|
||||||
if self._last_num_touches == 1:
|
if self._last_num_touches == 1:
|
||||||
# Single finger up
|
# Single finger up - use last tracked position
|
||||||
gesture = self.gesture_detector.on_touch_up(
|
gesture = self.gesture_detector.on_touch_up(
|
||||||
self.gesture_detector.current_pos[0] if self.gesture_detector.current_pos else 0,
|
self._last_touch_pos[0],
|
||||||
self.gesture_detector.current_pos[1] if self.gesture_detector.current_pos else 0,
|
self._last_touch_pos[1],
|
||||||
finger=0
|
finger=0
|
||||||
)
|
)
|
||||||
self._tracking_touch = False
|
self._tracking_touch = False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user