fixed: legacy on-screen control layers pass through native touch events

This commit is contained in:
TrueZhuanjia
2025-10-28 08:37:26 +08:00
parent 9c518dfeb6
commit 99952281cb
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -213,6 +213,7 @@
if (asyncNativeTouch) dispatch_async(dispatch_get_global_queue(touchDownQos, 0), ^{
for (UITouch* touch in touches){
// continue to the next loop if current touch is already captured by OSC. works only in regular native touch
if([OnScreenControls.touchAddrsCapturedByOnScreenControls containsObject:@((uintptr_t)touch)]) continue;
[self handleTouchDown:touch]; //generate & populate pointerId
if(self->activateCoordSelector) [self populatePointerObjIntoDict:touch];
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_DOWN];
@@ -221,6 +222,7 @@
else{
for (UITouch* touch in touches){
// continue to the next loop if current touch is already captured by OSC. works only in regular native touch
if([OnScreenControls.touchAddrsCapturedByOnScreenControls containsObject:@((uintptr_t)touch)]) continue;
[self handleTouchDown:touch]; //generate & populate pointerId
if(self->activateCoordSelector) [self populatePointerObjIntoDict:touch];
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_DOWN];
@@ -242,7 +244,11 @@
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_main_queue(), ^{
for (UITouch* touch in touches){
if([OnScreenControls.touchAddrsCapturedByOnScreenControls containsObject:@((uintptr_t)touch)]) continue;
NSNumber* touchAddrObj = @((uintptr_t)touch);
if([OnScreenControls.touchAddrsCapturedByOnScreenControls containsObject:touchAddrObj]){
[OnScreenControls.touchAddrsCapturedByOnScreenControls removeObject:touchAddrObj];
continue;
}
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_UP]; //send touch event before remove pointerId
[self removePointerId:touch]; //then remove pointerId
if(self->activateCoordSelector) [self removePointerObjFromDict:touch];
+1 -1
View File
@@ -1437,7 +1437,7 @@ static float L3_Y;
for (UITouch* touch in touches) {
// remove the touch obj from touchesCapturedByOnScreenButtons
if([touchAddrsCapturedByOnScreenControls containsObject:@((uintptr_t)touch)]) [touchAddrsCapturedByOnScreenControls removeObject:@((uintptr_t)touch)];
// if([touchAddrsCapturedByOnScreenControls containsObject:@((uintptr_t)touch)]) [touchAddrsCapturedByOnScreenControls removeObject:@((uintptr_t)touch)];
if (touch == _aTouch) {
[_controllerSupport clearButtonFlag:_controller flags:A_FLAG];