Always rescroll after the carousel is re-initalized.
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@
|
|||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"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.2.0",
|
||||||
"embla-carousel-wheel-gestures": "^2.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",
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ export class FrigateCardThumbnailCarousel extends FrigateCardCarousel {
|
|||||||
protected _resizeHandler(): void {
|
protected _resizeHandler(): void {
|
||||||
if (this._carousel) {
|
if (this._carousel) {
|
||||||
this._carousel.reInit();
|
this._carousel.reInit();
|
||||||
|
// Reinit will cause the scroll position to reset, so re-scroll to the
|
||||||
|
// correct location.
|
||||||
|
if (this._selected !== undefined && this._selected !== null) {
|
||||||
|
this.carouselScrollTo(this._selected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +107,7 @@ export class FrigateCardThumbnailCarousel extends FrigateCardCarousel {
|
|||||||
return {
|
return {
|
||||||
containScroll: 'keepSnaps',
|
containScroll: 'keepSnaps',
|
||||||
dragFree: true,
|
dragFree: true,
|
||||||
startIndex: this._selected ?? 0,
|
startIndex: this._selected ?? undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +144,6 @@ export class FrigateCardThumbnailCarousel extends FrigateCardCarousel {
|
|||||||
this.updateComplete.then(() => {
|
this.updateComplete.then(() => {
|
||||||
if (this._carousel) {
|
if (this._carousel) {
|
||||||
if (this._selected !== undefined && this._selected !== null) {
|
if (this._selected !== undefined && this._selected !== null) {
|
||||||
console.info('thumbnail carousel scroll to')
|
|
||||||
this.carouselScrollTo(this._selected);
|
this.carouselScrollTo(this._selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user