Add wheel gestures and fix scrolling issue.
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
"custom-card-helpers": "^1.9.0",
|
"custom-card-helpers": "^1.9.0",
|
||||||
"date-fns": "^2.28.0",
|
"date-fns": "^2.28.0",
|
||||||
"embla-carousel": "^6.1.1",
|
"embla-carousel": "^6.1.1",
|
||||||
|
"embla-carousel-wheel-gestures": "^2.1.1",
|
||||||
"home-assistant-js-websocket": "^6.1.1",
|
"home-assistant-js-websocket": "^6.1.1",
|
||||||
"keycharm": "^0.4.0",
|
"keycharm": "^0.4.0",
|
||||||
"lit": "^2.2.1",
|
"lit": "^2.2.1",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import EmblaCarousel, {
|
|||||||
EmblaOptionsType,
|
EmblaOptionsType,
|
||||||
EmblaPluginType,
|
EmblaPluginType,
|
||||||
} from 'embla-carousel';
|
} from 'embla-carousel';
|
||||||
|
import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures'
|
||||||
|
|
||||||
import { TransitionEffect } from '../types';
|
import { TransitionEffect } from '../types';
|
||||||
import { dispatchFrigateCardEvent } from '../common';
|
import { dispatchFrigateCardEvent } from '../common';
|
||||||
@@ -76,8 +77,12 @@ export class FrigateCardCarousel extends LitElement {
|
|||||||
* Get the Embla plugins to use.
|
* Get the Embla plugins to use.
|
||||||
* @returns An EmblaOptionsType object or undefined for no options.
|
* @returns An EmblaOptionsType object or undefined for no options.
|
||||||
*/
|
*/
|
||||||
protected _getPlugins(): EmblaPluginType[] | undefined {
|
protected _getPlugins(): EmblaPluginType[] {
|
||||||
return undefined;
|
return [WheelGesturesPlugin({
|
||||||
|
// Whether the carousel is vertical or horizontal, interpret y-axis wheel
|
||||||
|
// gestures as scrolling for the carousel.
|
||||||
|
forceWheelAxis: 'y',
|
||||||
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _destroyCarousel(): void {
|
protected _destroyCarousel(): void {
|
||||||
|
|||||||
@@ -344,8 +344,9 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
|
|||||||
* Get the Embla plugins to use.
|
* Get the Embla plugins to use.
|
||||||
* @returns An EmblaOptionsType object or undefined for no options.
|
* @returns An EmblaOptionsType object or undefined for no options.
|
||||||
*/
|
*/
|
||||||
protected _getPlugins(): EmblaPluginType[] | undefined {
|
protected _getPlugins(): EmblaPluginType[] {
|
||||||
return [
|
return [
|
||||||
|
...super._getPlugins(),
|
||||||
Lazyload({
|
Lazyload({
|
||||||
lazyloadCallback: this.liveConfig?.lazy_load
|
lazyloadCallback: this.liveConfig?.lazy_load
|
||||||
? (...args) => this._lazyloadOrUnloadSlide('load', ...args)
|
? (...args) => this._lazyloadOrUnloadSlide('load', ...args)
|
||||||
|
|||||||
@@ -331,8 +331,9 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
|
|||||||
* Get the Embla plugins to use.
|
* Get the Embla plugins to use.
|
||||||
* @returns An EmblaOptionsType object or undefined for no options.
|
* @returns An EmblaOptionsType object or undefined for no options.
|
||||||
*/
|
*/
|
||||||
protected _getPlugins(): EmblaPluginType[] | undefined {
|
protected _getPlugins(): EmblaPluginType[] {
|
||||||
return [
|
return [
|
||||||
|
...super._getPlugins(),
|
||||||
Lazyload({
|
Lazyload({
|
||||||
lazyloadCallback: this.viewerConfig?.lazy_load
|
lazyloadCallback: this.viewerConfig?.lazy_load
|
||||||
? this._lazyloadSlide.bind(this)
|
? this._lazyloadSlide.bind(this)
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
:host {
|
:host {
|
||||||
--frigate-card-carousel-thumbnail-opacity: 0.8;
|
--frigate-card-carousel-thumbnail-opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host([direction=vertical]) {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
:host([direction=horizontal]) {
|
||||||
// In fullscreen mode, without explicitly setting the height to auto Chrome
|
// In fullscreen mode, without explicitly setting the height to auto Chrome
|
||||||
// will construct a stylesheet with 100% height.
|
// will construct a stylesheet with 100% height.
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|||||||
@@ -4,16 +4,19 @@
|
|||||||
:host {
|
:host {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: block;
|
|
||||||
background-color: var(--card-background-color);
|
background-color: var(--card-background-color);
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
|
|
||||||
|
// Share the screen space with thumbnails that may be above/below.
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
// So that absolute sidedrawer is relative to this host.
|
// So that absolute sidedrawer is relative to this host.
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.timeline {
|
div.timeline {
|
||||||
height: 100%;
|
flex: 1;
|
||||||
}
|
}
|
||||||
div.timeline.left-margin {
|
div.timeline.left-margin {
|
||||||
// Clearance for the drawer button.
|
// Clearance for the drawer button.
|
||||||
|
|||||||
Reference in New Issue
Block a user