flixlix / power-flow-card-plus

A power distribution card inspired by the official Energy Distribution card for Home Assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Full-size scaling is not suitable for all screen sizes

Abb4d0n opened this issue · comments

Hi,

when using the "full-size" option, static scaling and translate values are used:

transform: scale(2) translateY(30%);

However, this is not suitable for all screen sizes.

Would it be possible to calculate a scale factor depending on the size of the ha-card tag and the content div?
Maybe something like this:

var hacard = document.getElementsByTagName("ha-card")[0];
var content = document.getElementById("power-flow-card-plus");
var scalefactor = Math.min(hacard.offsetHeight/ content.offsetHeight, hacard.offsetWidth / content.offsetWidth)
content.style.transform = "scale("+scalefactor+")";

Thanks