From 38f8c50d7f6ea06f310b7446c6309907dbfaa717 Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Wed, 18 Feb 2026 08:44:56 +0800 Subject: [PATCH] native touch track point fix --- VoidLink/Input/NativeTouchHandler.m | 36 ++++++++++--------------- VoidLink/Input/PureNativeTouchHandler.m | 36 ++++++++++--------------- 2 files changed, 28 insertions(+), 44 deletions(-) diff --git a/VoidLink/Input/NativeTouchHandler.m b/VoidLink/Input/NativeTouchHandler.m index e1b8a5e5..024ec358 100644 --- a/VoidLink/Input/NativeTouchHandler.m +++ b/VoidLink/Input/NativeTouchHandler.m @@ -281,32 +281,24 @@ continue; } [self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_UP withEvent:event]; //send touch event before remove pointerId - [self removePointerId:touch]; //then remove pointerId + + if(self->trackPointEnabled){ + dispatch_async(dispatch_get_main_queue(), ^{ + uint8_t pointerId = [self retrievePointerIdFromDict:touch]; + CAShapeLayer* trackPoint = self->trackPointPool[pointerId]; + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + trackPoint.hidden = true; + [CATransaction commit]; + [self removePointerId:touch]; + }); + } + else [self removePointerId:touch]; + if(self->activateCoordSelector) [self removePointerObjFromDict:touch]; [self->blacklistedTouches removeObject:@((uintptr_t)touch)]; } }); - - if(self->trackPointEnabled){ - if(touches.count == [UITouchUtil touchesIn:streamView from:event].count){ - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - for(CAShapeLayer* trackPoint in trackPointPool) trackPoint.hidden = true; - [CATransaction commit]; - return; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - for (UITouch* touch in touches){ - uint8_t pointerId = [self retrievePointerIdFromDict:touch]; - CAShapeLayer* trackPoint = self->trackPointPool[pointerId]; - trackPoint.hidden = true; - } - [CATransaction commit]; - }); - } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { diff --git a/VoidLink/Input/PureNativeTouchHandler.m b/VoidLink/Input/PureNativeTouchHandler.m index 27c70d76..81d4e630 100644 --- a/VoidLink/Input/PureNativeTouchHandler.m +++ b/VoidLink/Input/PureNativeTouchHandler.m @@ -266,32 +266,24 @@ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ for (UITouch* touch in touches){ [self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_UP]; //send touch event before remove pointerId - [self removePointerId:touch]; //then remove pointerId + + if(self->trackPointEnabled){ + dispatch_async(dispatch_get_main_queue(), ^{ + uint8_t pointerId = [self retrievePointerIdFromDict:touch]; + CAShapeLayer* trackPoint = self->trackPointPool[pointerId]; + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + trackPoint.hidden = true; + [CATransaction commit]; + [self removePointerId:touch]; + }); + } + else [self removePointerId:touch]; + if(self->activateCoordSelector) [self removePointerObjFromDict:touch]; [self->blacklistedTouches removeObject:@((uintptr_t)touch)]; } }); - - if(self->trackPointEnabled){ - if(touches.count == [UITouchUtil touchesIn:streamView from:event].count){ - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - for(CAShapeLayer* trackPoint in trackPointPool) trackPoint.hidden = true; - [CATransaction commit]; - return; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - for (UITouch* touch in touches){ - uint8_t pointerId = [self retrievePointerIdFromDict:touch]; - CAShapeLayer* trackPoint = self->trackPointPool[pointerId]; - trackPoint.hidden = true; - } - [CATransaction commit]; - }); - } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {