Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe46afb

Browse files
SergeyMellNathanWalker
authored andcommitted
fix(ios): gesture touch event coordinates improvements (#8998)
1 parent d038188 commit fe46afb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/ui/gestures/index.ios.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,14 @@ class TouchGestureEventData implements TouchGestureEventData {
601601
}
602602

603603
getX(): number {
604-
return this.getMainPointer().locationInView(this.view.nativeViewProtected).x;
604+
const offset = this.view.nativeViewProtected.contentOffset;
605+
const offsetX = offset ? offset.x : 0;
606+
return this.getMainPointer().locationInView(this.view.nativeViewProtected).x - offsetX;
605607
}
606608

607609
getY(): number {
608-
return this.getMainPointer().locationInView(this.view.nativeViewProtected).y;
610+
const offset = this.view.nativeViewProtected.contentOffset;
611+
const offsetY = offset ? offset.y : 0;
612+
return this.getMainPointer().locationInView(this.view.nativeViewProtected).y - offsetY;
609613
}
610614
}

0 commit comments

Comments
 (0)