From 709676cd8e75c6c9396d63b98f4c359c6228d955 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Sun, 12 Mar 2023 13:35:19 -0700 Subject: [PATCH] Minor fixes / clarifications. --- src/card.ts | 19 +++++++++++-------- src/scss/card.scss | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/card.ts b/src/card.ts index e910cc03..74b2a72c 100644 --- a/src/card.ts +++ b/src/card.ts @@ -13,7 +13,7 @@ import { createRef, ref, Ref } from 'lit/directives/ref.js'; import { StyleInfo, styleMap } from 'lit/directives/style-map.js'; import throttle from 'lodash-es/throttle'; import screenfull from 'screenfull'; -import { string, z } from 'zod'; +import { z } from 'zod'; import { actionHandler } from './action-handler-directive.js'; import { CardConditionManager, @@ -1816,13 +1816,16 @@ class FrigateCard extends LitElement { protected _setPropertiesForExpandedMode(): void { // When a new media loads, set the aspect ratio for when the card is - // expanded/popped-up. - if (this._view?.isAnyMediaView() && this._lastValidMediaLoadedInfo) { - this.style.setProperty( - '--frigate-card-expand-aspect-ratio', - `${this._lastValidMediaLoadedInfo.width} / ${this._lastValidMediaLoadedInfo.height}`, - ); - } + // expanded/popped-up. This is based exclusively on last media content, + // as dimension configuration does not apply in fullscreen or expanded mode. + this.style.setProperty( + '--frigate-card-expand-aspect-ratio', + this._view?.isAnyMediaView() && this._lastValidMediaLoadedInfo + ? `${this._lastValidMediaLoadedInfo.width} / ${this._lastValidMediaLoadedInfo.height}` + : 'unset', + ); + // Non-media mays have no intrinsic dimensions and so we need to explicit + // request the dialog to use all available space. this.style.setProperty( '--frigate-card-expand-width', this._view?.isAnyMediaView() ? 'none' : 'var(--frigate-card-expand-max-width)', diff --git a/src/scss/card.scss b/src/scss/card.scss index 2f25c88d..81e97b8b 100644 --- a/src/scss/card.scss +++ b/src/scss/card.scss @@ -19,6 +19,7 @@ --frigate-card-expand-max-width: 85vw; --frigate-card-expand-width: none; --frigate-card-expand-height: none; + --frigate-card-expand-aspect-ratio: unset; } :host([dark]) {