Close thumbnail drawer when something is chosen.
This commit is contained in:
@@ -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
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user