Allow the carousel 'slide' animation to be disabled.

This commit is contained in:
Dermot Duffy
2022-02-08 20:36:07 -08:00
parent ec33a2ddf8
commit 724ca4c843
9 changed files with 67 additions and 3 deletions
+10 -1
View File
@@ -5,6 +5,7 @@ import EmblaCarousel, {
EmblaPluginType,
} from 'embla-carousel';
import { TransitionEffect } from '../types';
import { dispatchFrigateCardEvent } from '../common';
import carouselStyle from '../scss/carousel.scss';
@@ -22,7 +23,7 @@ export class FrigateCardCarousel extends LitElement {
* @param index Slide number.
*/
carouselScrollTo(index: number): void {
this._carousel?.scrollTo(index);
this._carousel?.scrollTo(index, this._getTransitionEffect() === 'none');
}
/**
@@ -50,6 +51,14 @@ export class FrigateCardCarousel extends LitElement {
}
}
/**
* Get the transition effect to use.
* @returns An TransitionEffect object.
*/
protected _getTransitionEffect(): TransitionEffect | undefined {
return 'slide';
}
/**
* Get the Embla options to use.
* @returns An EmblaOptionsType object or undefined for no options.