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 committed by GitHub
parent 81277fd12e
commit 0fcedc5046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {