Performance improvements.

This commit is contained in:
Dermot Duffy
2022-07-23 14:59:46 -07:00
parent 54079d4a08
commit 773b5cf318
5 changed files with 48 additions and 25 deletions
+10 -1
View File
@@ -87,7 +87,7 @@ export class FrigateCardCarousel extends LitElement {
const destroyProperties = [
'direction',
'carouselOptions',
'carouselOptions',
'carouselPlugins',
] as const;
if (destroyProperties.some((prop) => changedProps.has(prop))) {
this._destroyCarousel();
@@ -255,11 +255,20 @@ export class FrigateCardCarousel extends LitElement {
this._scrolling = true;
});
this._carousel.on('settle', () => {
// Reinitialize the carousel if a request to reinitialize was made
// during scrolling (instead the request is handled after the scrolling
// has settled).
this._scrolling = false;
if (this._reInitOnSettle) {
this._reInitOnSettle = false;
this._carouselReInitInPlace();
}
})
this._carousel.on('settle', () => {
const selected = this.getCarouselSelected();
if (selected) {
dispatchFrigateCardEvent<CarouselSelect>(this, 'carousel:settle', selected);
}
});
}
}