From e1c509b4c467ee31de7612f59eedc515f0c7f609 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Mon, 16 May 2022 13:02:59 -0300 Subject: [PATCH] Try harder to retain current view For non-Frigate cameras when switching. --- src/card.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/card.ts b/src/card.ts index a17c889a..cba2ea2b 100644 --- a/src/card.ts +++ b/src/card.ts @@ -1081,10 +1081,16 @@ export class FrigateCard extends LitElement { view: new View({ view: this._getConfig().view.camera_select === 'current' - ? // Always go to live view when switching to a non-Frigate camera + ? // When switching to a Frigate camera, this._cameras?.get(camera)?.camera_name + ? // always retain the current view. + this._view.view + : // But when switching to a non-Frigate camera, + // only retain the current view if it's supported + ['timeline', 'image', 'live'].includes(this._view.view) ? this._view.view - : 'live' + : // And fallback to the live view otherwise. + 'live' : (this._getConfig().view.camera_select as FrigateCardView), camera: camera, }),