Add wheel gestures and fix scrolling issue.

This commit is contained in:
Dermot Duffy
2022-03-21 19:48:09 -07:00
parent c53a3cb818
commit b649401f11
6 changed files with 22 additions and 6 deletions
+7 -2
View File
@@ -6,6 +6,7 @@ import EmblaCarousel, {
EmblaOptionsType,
EmblaPluginType,
} from 'embla-carousel';
import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures'
import { TransitionEffect } from '../types';
import { dispatchFrigateCardEvent } from '../common';
@@ -76,8 +77,12 @@ export class FrigateCardCarousel extends LitElement {
* Get the Embla plugins to use.
* @returns An EmblaOptionsType object or undefined for no options.
*/
protected _getPlugins(): EmblaPluginType[] | undefined {
return undefined;
protected _getPlugins(): EmblaPluginType[] {
return [WheelGesturesPlugin({
// Whether the carousel is vertical or horizontal, interpret y-axis wheel
// gestures as scrolling for the carousel.
forceWheelAxis: 'y',
})];
}
protected _destroyCarousel(): void {
+2 -1
View File
@@ -344,8 +344,9 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
* Get the Embla plugins to use.
* @returns An EmblaOptionsType object or undefined for no options.
*/
protected _getPlugins(): EmblaPluginType[] | undefined {
protected _getPlugins(): EmblaPluginType[] {
return [
...super._getPlugins(),
Lazyload({
lazyloadCallback: this.liveConfig?.lazy_load
? (...args) => this._lazyloadOrUnloadSlide('load', ...args)
+2 -1
View File
@@ -331,8 +331,9 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
* Get the Embla plugins to use.
* @returns An EmblaOptionsType object or undefined for no options.
*/
protected _getPlugins(): EmblaPluginType[] | undefined {
protected _getPlugins(): EmblaPluginType[] {
return [
...super._getPlugins(),
Lazyload({
lazyloadCallback: this.viewerConfig?.lazy_load
? this._lazyloadSlide.bind(this)