Fix message on initialization rendering.

This commit is contained in:
Dermot Duffy
2023-10-02 19:00:30 -07:00
parent a3b1e5f834
commit d23f87a39b
3 changed files with 18 additions and 5 deletions
-1
View File
@@ -1,4 +1,3 @@
// TODO: test errors during rendering to make sure resetMessage is no longer necessary.
// TODO: Test HA state connection/disconnect logic in real life.
// TODO: Should not need to import screenfull anywhere except the fullscreen manager.
// TODO: executeMediaQueryForView should not need a HTMLElement host parameter see the view-manager.ts call in particular.
+9 -4
View File
@@ -74,7 +74,10 @@ export class StyleManager {
);
}
protected _isAspectRatioEnforced(config: FrigateCardConfig, view: View): boolean {
protected _isAspectRatioEnforced(
config: FrigateCardConfig,
view?: View | null,
): boolean {
const aspectRatioMode = config.dimensions.aspect_ratio_mode;
// Do not artifically constrain aspect ratio if:
@@ -88,8 +91,10 @@ export class StyleManager {
this._api.getExpandManager().isExpanded() ||
aspectRatioMode === 'unconstrained' ||
(aspectRatioMode === 'dynamic' &&
(view.isAnyMediaView() || view.is('timeline'))) ||
view.is('diagnostics')
(!view ||
view?.isAnyMediaView() ||
view?.is('timeline') ||
view?.is('diagnostics')))
);
}
@@ -102,7 +107,7 @@ export class StyleManager {
const config = this._api.getConfigManager().getConfig();
const view = this._api.getViewManager().getView();
if (config && view) {
if (config) {
if (!this._isAspectRatioEnforced(config, view)) {
return 'auto';
}