MOBILE-3320 gestures: Check pointer hasn't moved during long press
parent
bef5691e15
commit
586bda2b69
|
@ -27,6 +27,7 @@ export class CoreLongPressDirective implements OnInit, OnDestroy {
|
||||||
|
|
||||||
element: HTMLElement;
|
element: HTMLElement;
|
||||||
pressGesture?: Gesture;
|
pressGesture?: Gesture;
|
||||||
|
protected moved = false;
|
||||||
|
|
||||||
@Output() longPress = new EventEmitter();
|
@Output() longPress = new EventEmitter();
|
||||||
|
|
||||||
|
@ -42,8 +43,11 @@ export class CoreLongPressDirective implements OnInit, OnDestroy {
|
||||||
this.pressGesture = GestureController.create({
|
this.pressGesture = GestureController.create({
|
||||||
el: this.element,
|
el: this.element,
|
||||||
threshold: 0,
|
threshold: 0,
|
||||||
|
disableScroll: true,
|
||||||
gestureName: 'longpress',
|
gestureName: 'longpress',
|
||||||
onEnd: ev => this.longPress.emit(ev.event),
|
onStart: () => this.moved = false,
|
||||||
|
onMove: () => this.moved = true,
|
||||||
|
onEnd: ev => !this.moved && this.longPress.emit(ev.event),
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
this.pressGesture.enable();
|
this.pressGesture.enable();
|
||||||
|
|
Loading…
Reference in New Issue