mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixed multiple gestures for Android
This commit is contained in:
@@ -126,18 +126,15 @@ export class GesturesObserver implements definition.GesturesObserver {
|
||||
public disconnect() {
|
||||
// remove gesture observer from map
|
||||
if (this.target) {
|
||||
var gestureObserversArray = this.target._gestureObservers.get(this.type);
|
||||
if (gestureObserversArray) {
|
||||
var i;
|
||||
for (i = 0; i < gestureObserversArray.length; i++) {
|
||||
if (gestureObserversArray[i].callback === this.callback) {
|
||||
var list = this.target.getGestureObservers(this.type);
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].callback === this.callback) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
gestureObserversArray.splice(i, 1);
|
||||
if (gestureObserversArray.length === 0) {
|
||||
this.target._gestureObservers.delete(this.type);
|
||||
}
|
||||
list.length = 0;
|
||||
this.target._gestureObservers.delete(this.type);
|
||||
}
|
||||
}
|
||||
this._target = null;
|
||||
|
||||
@@ -185,7 +185,7 @@ class TapAndDoubleTapGestureListener extends android.view.GestureDetector.Simple
|
||||
}
|
||||
|
||||
public onSingleTapConfirmed(motionEvent: android.view.MotionEvent): boolean {
|
||||
if (this._type === definition.GestureTypes.tap) {
|
||||
if (this._type & definition.GestureTypes.tap) {
|
||||
var args = _getArgs(definition.GestureTypes.tap, this._target, motionEvent);
|
||||
_executeCallback(this._observer, args);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class TapAndDoubleTapGestureListener extends android.view.GestureDetector.Simple
|
||||
}
|
||||
|
||||
public onDoubleTap(motionEvent: android.view.MotionEvent): boolean {
|
||||
if (this._type === definition.GestureTypes.doubleTap) {
|
||||
if (this._type & definition.GestureTypes.doubleTap) {
|
||||
var args = _getArgs(definition.GestureTypes.doubleTap, this._target, motionEvent);
|
||||
_executeCallback(this._observer, args);
|
||||
}
|
||||
@@ -204,12 +204,11 @@ class TapAndDoubleTapGestureListener extends android.view.GestureDetector.Simple
|
||||
return true;
|
||||
}
|
||||
|
||||
public onLongPress(motionEvent: android.view.MotionEvent): boolean {
|
||||
if (this._type === definition.GestureTypes.longPress) {
|
||||
public onLongPress(motionEvent: android.view.MotionEvent): void {
|
||||
if (this._type & definition.GestureTypes.longPress) {
|
||||
var args = _getArgs(definition.GestureTypes.longPress, this._target, motionEvent);
|
||||
_executeCallback(this._observer, args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user