mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
parent
419f23879a
commit
1c139d0bc7
@ -102,6 +102,7 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
ratio && ratio.w > 0 && ratio.h > 0
|
ratio && ratio.w > 0 && ratio.h > 0
|
||||||
? `${((100 * ratio.h) / ratio.w).toFixed(2)}`
|
? `${((100 * ratio.h) / ratio.w).toFixed(2)}`
|
||||||
: "100";
|
: "100";
|
||||||
|
|
||||||
return 1 + Math.floor(Number(ar) / 25) || 3;
|
return 1 + Math.floor(Number(ar) / 25) || 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,10 +186,21 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected firstUpdated(changedProps: PropertyValues): void {
|
protected updated(changedProps: PropertyValues): void {
|
||||||
super.firstUpdated(changedProps);
|
if (this._config?.hours_to_show && this._configEntities?.length) {
|
||||||
const root = this.shadowRoot!.getElementById("root");
|
if (changedProps.has("_config")) {
|
||||||
|
this._getHistory();
|
||||||
|
} else if (Date.now() - this._date!.getTime() >= MINUTE) {
|
||||||
|
this._getHistory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (changedProps.has("_config")) {
|
||||||
|
this._computePadding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _computePadding(): void {
|
||||||
|
const root = this.shadowRoot!.getElementById("root");
|
||||||
if (!this._config || this.isPanel || !root) {
|
if (!this._config || this.isPanel || !root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -206,16 +218,6 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
: (root.style.paddingBottom = "100%");
|
: (root.style.paddingBottom = "100%");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updated(changedProps: PropertyValues): void {
|
|
||||||
if (this._config?.hours_to_show && this._configEntities?.length) {
|
|
||||||
if (changedProps.has("_config")) {
|
|
||||||
this._getHistory();
|
|
||||||
} else if (Date.now() - this._date!.getTime() >= MINUTE) {
|
|
||||||
this._getHistory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private _fitMap() {
|
private _fitMap() {
|
||||||
this._map?.fitMap();
|
this._map?.fitMap();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user