Skip to content

Panning gesture in Android creates non-smooth delta coordinates.  #2113

@JoshDSommer

Description

@JoshDSommer

if you add a panning event and add a console.log message outputting the delta coordinates to the console in iOS you will see a smooth coordinates transition like below:

May 14 07:31:31 Joshs-MacBook-Pro slide[64850]: CONSOLE LOG file:///app/nativescript-intro-slides.js:190:28: deltaX:-19.5  deltaY:138.5
May 14 07:31:31 Joshs-MacBook-Pro slide[64850]: CONSOLE LOG file:///app/nativescript-intro-slides.js:190:28: deltaX:-18.5  deltaY:138.5
May 14 07:31:31 Joshs-MacBook-Pro slide[64850]: CONSOLE LOG file:///app/nativescript-intro-slides.js:190:28: deltaX:-17.5  deltaY:138.5
May 14 07:31:31 Joshs-MacBook-Pro slide[64850]: CONSOLE LOG file:///app/nativescript-intro-slides.js:190:28: deltaX:-16.5  deltaY:138.5

however on Android in the console you will see occasional coordinates that jump back and forth such as the deltaX coordinates below:

JS: deltaX:-90.51925223214283  deltaY:-2.868350074404759
JS: deltaX:-86.28752790178572  deltaY:-2.868350074404759
JS: deltaX:-90.90020461309524  deltaY:-2.868350074404759
JS: deltaX:-85.31352306547615  deltaY:-2.868350074404759
JS: deltaX:-90.73135230654759  deltaY:-2.868350074404759
JS: deltaX:-90.73135230654759  deltaY:-2.868350074404759

I believe this is because in the gestures.android.ts file for the CustomPanGestureDetector it is is using getX(int) and getY(int). I've tested changing this to getRawX() and getRawY() and seen a noticeable improvement in the coordinate bounce.

here is the PR with a potential fix. #2114

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions