Fix bug causing the wrong media load event to be dispatched.

This commit is contained in:
Dermot Duffy
2022-01-14 21:31:16 -08:00
parent fd8cdf21a0
commit faeb4a4a7e
2 changed files with 11 additions and 2 deletions
-1
View File
@@ -1,5 +1,4 @@
// TODO Live scrolling nav buttons disappearing
// TODO Media loading events appear wrong for snapshot viewer
// TODO can I do away with clip/snapshot-specific?
// TODO Live carousel chevron/icons style
// TODO call change-event in viewer
+10
View File
@@ -709,7 +709,17 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
}
}}
@load="${(e: Event) => {
if (
// This handler will be called on the empty image (including
// an updated empty image that is the same dimensions large as
// the previously fully loaded image -- see the note on dummy
// images in media-carousel.ts). Here we need to only call the
// media load handler on a 'real' load.
!lazyLoad ||
this._slideHasBeenLazyLoaded[slideIndex]
) {
this._mediaLoadedHandler(slideIndex, createMediaShowInfo(e));
}
}}"
/>`}
</div>