MOBILE-3926 core: Disable tablet swipe navigation
parent
683c5f4e5a
commit
e42cab8d8b
|
@ -1,4 +1,4 @@
|
||||||
<ion-slides [options]="{ allowTouchMove: !!manager }" (swipeleft)="swipeLeft()" (swiperight)="swipeRight()">
|
<ion-slides [options]="{ allowTouchMove: enabled }" (swipeleft)="swipeLeft()" (swiperight)="swipeRight()">
|
||||||
<ion-slide>
|
<ion-slide>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</ion-slide>
|
</ion-slide>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { CoreSwipeItemsManager } from '@classes/items-management/swipe-items-manager';
|
import { CoreSwipeItemsManager } from '@classes/items-management/swipe-items-manager';
|
||||||
|
import { CoreScreen } from '@services/screen';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'core-swipe-navigation',
|
selector: 'core-swipe-navigation',
|
||||||
|
@ -24,10 +25,18 @@ export class CoreSwipeNavigationComponent {
|
||||||
|
|
||||||
@Input() manager?: CoreSwipeItemsManager;
|
@Input() manager?: CoreSwipeItemsManager;
|
||||||
|
|
||||||
|
get enabled(): boolean {
|
||||||
|
return CoreScreen.isMobile && !!this.manager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swipe to previous item.
|
* Swipe to previous item.
|
||||||
*/
|
*/
|
||||||
swipeLeft(): void {
|
swipeLeft(): void {
|
||||||
|
if (!this.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.manager?.navigateToPreviousItem();
|
this.manager?.navigateToPreviousItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +44,10 @@ export class CoreSwipeNavigationComponent {
|
||||||
* Swipe to next item.
|
* Swipe to next item.
|
||||||
*/
|
*/
|
||||||
swipeRight(): void {
|
swipeRight(): void {
|
||||||
|
if (!this.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.manager?.navigateToNextItem();
|
this.manager?.navigateToNextItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue