From 2789e455f1e7b076c335b1f1ff28ec0dc4864b80 Mon Sep 17 00:00:00 2001 From: Lars Saalbach Date: Wed, 4 Sep 2024 23:00:32 +0200 Subject: [PATCH] Disable swiper if swiper hast just one slide, to make it possible to slide the menu still, because swiper grabs it else --- .../brew-information.component.ts | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/brew-information/brew-information.component.ts b/src/components/brew-information/brew-information.component.ts index 3537da56..4706c8da 100644 --- a/src/components/brew-information/brew-information.component.ts +++ b/src/components/brew-information/brew-information.component.ts @@ -118,16 +118,24 @@ export class BrewInformationComponent implements OnInit { this.informationContainerWidth = this.brewInformationContainer?.nativeElement?.offsetWidth - 50; - /**If we slide on a bigger tablet, somehow ionic triggering the menu when sliding from right to left, thats why we need to attach us to touchstart/end and to ignore the slide...**/ - this.brewInformationSlider?.nativeElement.swiper.on( - 'touchStart', - () => { - this.menu.swipeGesture(false); - } - ); - this.brewInformationSlider?.nativeElement.swiper.on('touchEnd', () => { - this.menu.swipeGesture(true); - }); + if (this.brew.flow_profile) { + /**If we slide on a bigger tablet, somehow ionic triggering the menu when sliding from right to left, thats why we need to attach us to touchstart/end and to ignore the slide...**/ + this.brewInformationSlider?.nativeElement.swiper.on( + 'touchStart', + () => { + //We got two slides + this.menu.swipeGesture(false); + } + ); + this.brewInformationSlider?.nativeElement.swiper.on( + 'touchEnd', + () => { + this.menu.swipeGesture(true); + } + ); + } else { + this.brewInformationSlider?.nativeElement.swiper.disable(); + } }, 150); } }