joBr99 / nspanel-lovelace-ui

Custom Firmware for NsPanel with the design of HomeAssistant's lovelace UI in mind, works with Tasmota.
GNU General Public License v3.0
882 stars 191 forks source link

[Feature Request] CardGrid2 - optimize text-width #964

Closed kuckuckmann closed 1 year ago

kuckuckmann commented 1 year ago

FEATURE DESCRIPTION

With the opportunity of 8 items at CardGrid2 the relation between field width and text-size is unproportunal. A minimal text-digit of 4 should be displayable in relation to the field width. Maybe it's possible to let the text be resized in relation to its digits? In my specific example I am talking about temperatures with 1 decimal (for example 24.5).

CardGrid2_Temp1

ADDITIONAL CONTEXT

Add any other context about the problem here.

PANEL / FIRMWARE VERION

Please add the Panel/Firmware Version you are using (EU, US-L or US-P) EU-Panel, Tasmota 12.1, TFT 52

joBr99 commented 1 year ago

There is no way do dynamically change the font size in nextion.

The only option would be to change the font to a smaller one if the text is longer than X chars. The only downside is that not all of the chars have the same width. So there might be cases where this is changing the font too early or too late.

kuckuckmann commented 1 year ago

Well, isn't it the best case to take a wide character and create the width in depency of the amount of digits from 1 digit to 4 digits. So taking care that 4 digits with the maximum width possible can be displayed well?

joBr99 commented 1 year ago

for cardgrid2 we would need to change the font to a smaller one if the text is longer than 2 chars

image

joBr99 commented 1 year ago

I've implemented a way to force the panel to change the font on the icons.

XXX¬0 XXX¬3 XXX¬4

in case the 2nd last char is an ¬ it will pull the number after it and set it as font and then remove the last 2 chars from the string

Armilar commented 1 year ago

Implemented in v4.2.1.2 (ioBroker) - Use with pageItem-parameter: fontSize: (0-4) and

FlashNextion http://nspanel.pky.eu/lui.tft

https://forum.iobroker.net/topic/58170/sonoff-nspanel-mit-lovelace-ui/3528?_=1692957744727