From bc0198d242c7df5f032399b24bc39cf5078bf554 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Thu, 23 Sep 2021 21:48:44 -0700 Subject: [PATCH] Add aspect ratio editing. --- src/editor.ts | 35 +++++++++++++++++++++++++++++++++++ src/types.ts | 4 ++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/editor.ts b/src/editor.ts index a33d4918..a50f0ffa 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -137,6 +137,13 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor none: localize('control.none'), }; + const aspectRatioModes = { + '': '', + dynamic: localize('aspect_ratio_mode.dynamic'), + static: localize('aspect_ratio_mode.static'), + unconstrained: localize('aspect_ratio_mode.unconstrained'), + } + return html`
@@ -296,6 +303,34 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
+ + + ${Object.keys(aspectRatioModes).map((key) => { + return html` + ${aspectRatioModes[key]} + `; + })} + + +
+ input.split("/").map((d) => Number(d))) + .regex(/^\s*\d+\s*[:\/]\s*\d+\s*$/) + .transform((input) => input.split(/[:\/]/).map((d) => Number(d))) ).default([16, 9]), }).optional(),