From b114d7e0b52fabd45f3b9489e2d521d723a0837f Mon Sep 17 00:00:00 2001 From: splincode Date: Wed, 11 Dec 2024 10:26:56 +0300 Subject: [PATCH] fix(kit): do not react to swipes if draggable is disabled on carousel --- projects/kit/components/carousel/carousel.component.ts | 8 ++++---- projects/kit/components/carousel/carousel.template.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/kit/components/carousel/carousel.component.ts b/projects/kit/components/carousel/carousel.component.ts index c0fc8d43d8cd..11aaf8baf178 100644 --- a/projects/kit/components/carousel/carousel.component.ts +++ b/projects/kit/components/carousel/carousel.component.ts @@ -53,10 +53,10 @@ import {TuiCarouselScroll} from './carousel-scroll.directive'; host: { '[class._transitioned]': 'transitioned', '[class._draggable]': 'draggable', - '(touchstart)': 'onTransitioned(false)', - '(touchend)': 'onTransitioned(true)', - '(mousedown)': 'onTransitioned(false)', - '(document:mouseup.silent)': 'onTransitioned(true)', + '(touchstart)': 'draggable ? onTransitioned(false) : (0)', + '(touchend)': 'draggable ? onTransitioned(true): (0)', + '(mousedown)': 'draggable ? onTransitioned(false): (0)', + '(document:mouseup.silent)': 'draggable ?onTransitioned(true): (0)', }, }) export class TuiCarouselComponent { diff --git a/projects/kit/components/carousel/carousel.template.html b/projects/kit/components/carousel/carousel.template.html index a168b62ea9eb..9d5b5e26ac23 100644 --- a/projects/kit/components/carousel/carousel.template.html +++ b/projects/kit/components/carousel/carousel.template.html @@ -13,7 +13,7 @@ [style.transform]="transform" (tuiCarouselAutoscroll)="onAutoscroll()" (tuiPan)="onPan($event[0])" - (tuiSwipe)="onSwipe($event.direction)" + (tuiSwipe)="draggable ? onSwipe($event.direction) : 0" >