mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Set defaults for background settings, restore old behavior (#23436)
Fixes https://github.com/home-assistant/frontend/issues/23421
This commit is contained in:
parent
a6a76155e5
commit
44423812f4
@ -115,14 +115,24 @@ export class HuiViewBackgroundEditor extends LitElement {
|
||||
};
|
||||
}
|
||||
|
||||
background = {
|
||||
transparency: 100,
|
||||
alignment: "center",
|
||||
size: "auto",
|
||||
repeat: "no-repeat",
|
||||
attachment: "scroll",
|
||||
...background,
|
||||
};
|
||||
if (!background) {
|
||||
background = {
|
||||
transparency: 33,
|
||||
alignment: "center",
|
||||
size: "cover",
|
||||
repeat: "repeat",
|
||||
attachment: "fixed",
|
||||
};
|
||||
} else {
|
||||
background = {
|
||||
transparency: 100,
|
||||
alignment: "center",
|
||||
size: "cover",
|
||||
repeat: "no-repeat",
|
||||
attachment: "scroll",
|
||||
...background,
|
||||
};
|
||||
}
|
||||
|
||||
return html`
|
||||
<ha-form
|
||||
|
@ -52,8 +52,8 @@ export class HUIViewBackground extends LitElement {
|
||||
background?: string | LovelaceViewBackgroundConfig
|
||||
) {
|
||||
if (typeof background === "object" && background.image) {
|
||||
const size = background.size ?? "auto";
|
||||
const alignment = background.alignment ?? "center";
|
||||
const size = background.size ?? "cover";
|
||||
const repeat = background.repeat ?? "no-repeat";
|
||||
return `${alignment} / ${size} ${repeat} url('${background.image}')`;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user