changed getX and getY to getRawX and getRawY

getRawX & Y always return the X & Y coordinates relative to the view
getX and getY sometimes return coordinates that are relative to the
previous motion. this update will allow smoother coordinates on panning
instead of occasional  jumping back and fourth of the delta X and Y
coordinates
This commit is contained in:
Josh Sommer
2016-05-14 08:23:37 -04:00
committed by vakrilov
parent e0635a837d
commit 3427f93617

View File

@@ -110,7 +110,7 @@ export class GesturesObserver extends common.GesturesObserver {
this._eventData = new TouchGestureEventData();
}
this._eventData.prepare(this.target, motionEvent);
this._eventData.prepare(this.target, motionEvent);
_executeCallback(this, this._eventData);
}
@@ -489,9 +489,9 @@ class CustomPanGestureDetector {
private getMotionEventCenter(event: android.view.MotionEvent): { x: number, y: number } {
let count = event.getPointerCount();
let res = { x: 0, y: 0 };
for (var i = 0; i < count; i++) {
res.x += event.getX(i);
res.y += event.getY(i);
for (let i = 0; i < count; i++) {
res.x += event.getRawX();
res.y += event.getRawY();
}
res.x /= (count * this.density);