Fix media control card background image (#18891)

This commit is contained in:
Bram Kragten 2023-12-05 09:15:04 +01:00 committed by GitHub
parent dddba7af00
commit ff8f0697c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,6 +101,8 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
} }
this._config = config; this._config = config;
this.updateComplete.then(() => this._measureCard());
} }
public connectedCallback(): void { public connectedCallback(): void {
@ -339,15 +341,12 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
protected firstUpdated(): void { protected firstUpdated(): void {
this._attachObserver(); this._attachObserver();
this._measureCard();
} }
public willUpdate(changedProps: PropertyValues): void { public willUpdate(changedProps: PropertyValues): void {
super.willUpdate(changedProps); super.willUpdate(changedProps);
if (!this.hasUpdated) {
this._measureCard();
}
if ( if (
!this._config || !this._config ||
!this.hass || !this.hass ||
@ -468,6 +467,7 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
private _measureCard() { private _measureCard() {
const card = this.shadowRoot!.querySelector("ha-card"); const card = this.shadowRoot!.querySelector("ha-card");
if (!card) { if (!card) {
return; return;
} }