Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,15 @@ open class GestureHandler {
}

private fun dispatchTouchUpEvent(event: MotionEvent, sourceEvent: MotionEvent) {
val pointerId = event.getPointerId(event.actionIndex)

if (trackedPointers[pointerId] == null) {
return
}

extractAllPointersData()
changedTouchesPayload = null
touchEventType = RNGestureHandlerTouchEvent.EVENT_TOUCH_UP
val pointerId = event.getPointerId(event.actionIndex)
val offsetX = sourceEvent.rawX - sourceEvent.x
val offsetY = sourceEvent.rawY - sourceEvent.y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
{
int registeredTouches = [self registeredTouchesCount];

NSDictionary *data[registeredTouches];

Check warning on line 97 in packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm

View workflow job for this annotation

GitHub Actions / build (apps/basic-example)

variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
int nextIndex = 0;

for (int i = 0; i < MAX_POINTERS_COUNT; i++) {
Expand All @@ -115,19 +115,26 @@

_eventType = RNGHTouchEventTypePointerDown;

NSDictionary *data[touches.count];

Check warning on line 118 in packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm

View workflow job for this annotation

GitHub Actions / build (apps/basic-example)

variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
int changedCount = 0;

for (int i = 0; i < [touches count]; i++) {
RNGHUITouch *touch = [[touches allObjects] objectAtIndex:i];
int index = [self registerTouch:touch];
if (index >= 0) {
_trackedPointersCount++;

if (index < 0) {
continue;
}

data[i] = [self extractPointerData:index forTouch:touch];
_trackedPointersCount++;
data[changedCount++] = [self extractPointerData:index forTouch:touch];
}

if (changedCount == 0) {
return;
}

_changedPointersData = [[NSArray alloc] initWithObjects:data count:[touches count]];
_changedPointersData = [[NSArray alloc] initWithObjects:data count:changedCount];
// extract all touches last to include the ones that were just added
[self extractAllTouches];
[self sendEvent];
Expand All @@ -141,15 +148,25 @@

_eventType = RNGHTouchEventTypePointerMove;

NSDictionary *data[touches.count];

Check warning on line 151 in packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm

View workflow job for this annotation

GitHub Actions / build (apps/basic-example)

variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
int changedCount = 0;

for (int i = 0; i < [touches count]; i++) {
RNGHUITouch *touch = [[touches allObjects] objectAtIndex:i];
int index = [self findTouchIndex:touch];
data[i] = [self extractPointerData:index forTouch:touch];

if (index < 0) {
continue;
}

data[changedCount++] = [self extractPointerData:index forTouch:touch];
}

_changedPointersData = [[NSArray alloc] initWithObjects:data count:[touches count]];
if (changedCount == 0) {
return;
}

_changedPointersData = [[NSArray alloc] initWithObjects:data count:changedCount];
[self extractAllTouches];
[self sendEvent];
}
Expand All @@ -165,19 +182,26 @@

_eventType = RNGHTouchEventTypePointerUp;

NSDictionary *data[touches.count];

Check warning on line 185 in packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm

View workflow job for this annotation

GitHub Actions / build (apps/basic-example)

variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
int changedCount = 0;

for (int i = 0; i < [touches count]; i++) {
RNGHUITouch *touch = [[touches allObjects] objectAtIndex:i];
int index = [self unregisterTouch:touch];
if (index >= 0) {
_trackedPointersCount--;

if (index < 0) {
continue;
}

data[i] = [self extractPointerData:index forTouch:touch];
_trackedPointersCount--;
data[changedCount++] = [self extractPointerData:index forTouch:touch];
}

if (changedCount == 0) {
return;
}

_changedPointersData = [[NSArray alloc] initWithObjects:data count:[touches count]];
_changedPointersData = [[NSArray alloc] initWithObjects:data count:changedCount];
[self sendEvent];
}

Expand Down Expand Up @@ -218,7 +242,7 @@

if (registeredTouches > 0) {
int nextIndex = 0;
NSDictionary *data[registeredTouches];

Check warning on line 245 in packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm

View workflow job for this annotation

GitHub Actions / build (apps/basic-example)

variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]

for (int i = 0; i < MAX_POINTERS_COUNT; i++) {
RNGHUITouch *touch = _trackedPointers[i];
Expand Down
Loading