mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +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 = {
|
if (!background) {
|
||||||
transparency: 100,
|
background = {
|
||||||
alignment: "center",
|
transparency: 33,
|
||||||
size: "auto",
|
alignment: "center",
|
||||||
repeat: "no-repeat",
|
size: "cover",
|
||||||
attachment: "scroll",
|
repeat: "repeat",
|
||||||
...background,
|
attachment: "fixed",
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
background = {
|
||||||
|
transparency: 100,
|
||||||
|
alignment: "center",
|
||||||
|
size: "cover",
|
||||||
|
repeat: "no-repeat",
|
||||||
|
attachment: "scroll",
|
||||||
|
...background,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-form
|
<ha-form
|
||||||
|
@ -52,8 +52,8 @@ export class HUIViewBackground extends LitElement {
|
|||||||
background?: string | LovelaceViewBackgroundConfig
|
background?: string | LovelaceViewBackgroundConfig
|
||||||
) {
|
) {
|
||||||
if (typeof background === "object" && background.image) {
|
if (typeof background === "object" && background.image) {
|
||||||
const size = background.size ?? "auto";
|
|
||||||
const alignment = background.alignment ?? "center";
|
const alignment = background.alignment ?? "center";
|
||||||
|
const size = background.size ?? "cover";
|
||||||
const repeat = background.repeat ?? "no-repeat";
|
const repeat = background.repeat ?? "no-repeat";
|
||||||
return `${alignment} / ${size} ${repeat} url('${background.image}')`;
|
return `${alignment} / ${size} ${repeat} url('${background.image}')`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user