Close thumbnail drawer when something is chosen.

This commit is contained in:
Dermot Duffy
2022-06-04 11:04:38 -07:00
parent e03f3cf7f8
commit 8b570c65a0
2 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -145,6 +145,8 @@ export class FrigateCardSurround extends LitElement {
.selected=${this.view.childIndex} .selected=${this.view.childIndex}
@frigate-card:change-view=${(ev: CustomEvent) => changeDrawer(ev, 'close')} @frigate-card:change-view=${(ev: CustomEvent) => changeDrawer(ev, 'close')}
@frigate-card:carousel:tap=${(ev: CustomEvent<ThumbnailCarouselTap>) => { @frigate-card:carousel:tap=${(ev: CustomEvent<ThumbnailCarouselTap>) => {
// Send the view change from the source of the tap event, so the
// view change will be caught by the handler above (to close the drawer).
this.view this.view
?.evolve({ ?.evolve({
view: this.targetView || 'event', view: this.targetView || 'event',
@@ -152,7 +154,7 @@ export class FrigateCardSurround extends LitElement {
childIndex: ev.detail.childIndex, childIndex: ev.detail.childIndex,
context: null, context: null,
}) })
.dispatchChangeEvent(this); .dispatchChangeEvent(ev.composedPath()[0]);
}} }}
> >
</frigate-card-thumbnail-carousel>` </frigate-card-thumbnail-carousel>`
+3 -3
View File
@@ -145,9 +145,9 @@ export class View {
/** /**
* Dispatch an event to request a view change. * Dispatch an event to request a view change.
* @param node The element dispatching the event. * @param target The target dispatching the event.
*/ */
public dispatchChangeEvent(node: HTMLElement): void { public dispatchChangeEvent(target: EventTarget): void {
dispatchFrigateCardEvent(node, 'change-view', this); dispatchFrigateCardEvent(target, 'change-view', this);
} }
} }