mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
fix(gestures): detecting swipe angle correctly + sliding item logic fix
This commit is contained in:
@ -44,8 +44,8 @@ export class ItemSlidingGesture {
|
||||
}
|
||||
|
||||
// Close open container if it is not the selected one.
|
||||
if (container !== this.openContainer && this.closeOpened()) {
|
||||
return false;
|
||||
if (container !== this.openContainer) {
|
||||
this.closeOpened();
|
||||
}
|
||||
|
||||
// Try to start gesture
|
||||
|
@ -51,12 +51,13 @@ export class MenuContentGesture extends SlideEdgeGesture {
|
||||
return true;
|
||||
}
|
||||
|
||||
let cosine = Math.cos(ev.angle * (Math.PI / 180));
|
||||
if (menu.side === 'right') {
|
||||
if ((ev.angle > 140 && ev.angle <= 180) || (ev.angle > -140 && ev.angle <= -180)) {
|
||||
if (cosine < -0.95) {
|
||||
return super.canStart(ev);
|
||||
}
|
||||
} else {
|
||||
if (ev.angle > -40 && ev.angle < 40) {
|
||||
if (cosine > 0.95) {
|
||||
return super.canStart(ev);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user