mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 10:56:34 +00:00
Fix thermostat with radius 0 (#2633)
* Fix thermostat with radius 0 * remove afterNextRender
This commit is contained in:
parent
c964ea30e0
commit
2ad27f7400
@ -18,7 +18,6 @@ import { HomeAssistant, ClimateEntity } from "../../../types";
|
|||||||
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
||||||
import { LovelaceCardConfig } from "../../../data/lovelace";
|
import { LovelaceCardConfig } from "../../../data/lovelace";
|
||||||
import { loadRoundslider } from "../../../resources/jquery.roundslider.ondemand";
|
import { loadRoundslider } from "../../../resources/jquery.roundslider.ondemand";
|
||||||
import { afterNextRender } from "../../../common/util/render-status";
|
|
||||||
import { UNIT_F } from "../../../common/const";
|
import { UNIT_F } from "../../../common/const";
|
||||||
|
|
||||||
const thermostatConfig = {
|
const thermostatConfig = {
|
||||||
@ -212,15 +211,20 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
private async _initialLoad(): Promise<void> {
|
private async _initialLoad(): Promise<void> {
|
||||||
this._loaded = true;
|
this._loaded = true;
|
||||||
|
|
||||||
const radius = this.clientWidth / 3.2;
|
await this.updateComplete;
|
||||||
|
|
||||||
|
let radius = this.clientWidth / 3.2;
|
||||||
this._broadCard = this.clientWidth > 390;
|
this._broadCard = this.clientWidth > 390;
|
||||||
|
|
||||||
|
if (radius === 0) {
|
||||||
|
radius = 100;
|
||||||
|
}
|
||||||
|
|
||||||
(this.shadowRoot!.querySelector(
|
(this.shadowRoot!.querySelector(
|
||||||
"#thermostat"
|
"#thermostat"
|
||||||
)! as HTMLElement).style.height = radius * 2 + "px";
|
)! as HTMLElement).style.height = radius * 2 + "px";
|
||||||
|
|
||||||
const loaded = await loadRoundslider();
|
const loaded = await loadRoundslider();
|
||||||
await new Promise((resolve) => afterNextRender(resolve));
|
|
||||||
|
|
||||||
this._roundSliderStyle = loaded.roundSliderStyle;
|
this._roundSliderStyle = loaded.roundSliderStyle;
|
||||||
this._jQuery = loaded.jQuery;
|
this._jQuery = loaded.jQuery;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user