Fix getCardSize iFrame (#2487)

This commit is contained in:
Bram Kragten 2019-01-16 00:16:37 +01:00 committed by Paulus Schoutsen
parent 01c5b64c63
commit edf7485578

View File

@ -35,7 +35,13 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
}
public getCardSize(): number {
return 1 + this.offsetHeight / 50;
if (!this._config) {
return 3;
}
const aspectRatio = this._config.aspect_ratio
? Number(this._config.aspect_ratio.replace("%", ""))
: 50;
return 1 + aspectRatio / 25;
}
public setConfig(config: Config): void {
@ -79,7 +85,6 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
#root {
width: 100%;
position: relative;
padding-top: ${this._config!.aspect_ratio || "50%"};
}
iframe {
position: absolute;