Glance height fix (Again): A row could be zero height (#6110)

This commit is contained in:
Bram Kragten 2020-06-05 23:46:16 +02:00
parent f558f7fb8c
commit 10a5b3f9c3

View File

@ -66,17 +66,15 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
private _configEntities?: GlanceConfigEntity[];
public getCardSize(): number {
return (
(this._config!.title ? 1 : 0) +
Math.max(
((this._config!.show_icon ? 1 : 0) +
(this._config!.show_name && this._config!.show_state ? 1 : 0)) *
Math.ceil(
this._configEntities!.length / (this._config!.columns || 5)
),
1
)
const rowHeight =
(this._config!.show_icon ? 1 : 0) +
(this._config!.show_name && this._config!.show_state ? 1 : 0) || 1;
const numRows = Math.ceil(
this._configEntities!.length / (this._config!.columns || 5)
);
return (this._config!.title ? 1 : 0) + rowHeight * numRows;
}
public setConfig(config: GlanceCardConfig): void {