Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(color): attempt to show units for value widget if height < 50 - 2.10 #5811

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

mha1
Copy link
Contributor

@mha1 mha1 commented Jan 21, 2025

Fixes the issue were the value widget wouldn't display units in any of the four row screen layouts.

image

image

@pfeerick pfeerick added bug 🪲 Something isn't working color Related generally to color LCD radios widget labels Jan 22, 2025
@pfeerick pfeerick added this to the 2.10.6 milestone Jan 22, 2025
@pfeerick
Copy link
Member

I think the fault may be stemming from checking the height rather the width when making the decision to drop the units, as you might have lots of long (so plenty of space to show the unit) but not very tall rows... so might tinker with this a bit more.

btw, main form is preferred if it can be cherry-picked (this is not) or trivial to convert (this should be). But I did put you one the spot 😆

@pfeerick pfeerick changed the title Value widget: allow units to be displayed in four row screen layouts fix(color): value widget should show units in four row screen layouts Jan 22, 2025
@pfeerick pfeerick changed the title fix(color): value widget should show units in four row screen layouts fix(color): value widget should show units if layout wide enough Jan 22, 2025
@pfeerick pfeerick changed the title fix(color): value widget should show units if layout wide enough fix(color): value widget should show units if enough width - 2.10 Jan 22, 2025
@mha1
Copy link
Contributor Author

mha1 commented Jan 22, 2025

I think the fault may be stemming from checking the height rather the width when making the decision to drop the units, as you might have lots of long (so plenty of space to show the unit) but not very tall rows... so might tinker with this a bit more.

btw, main form is preferred if it can be cherry-picked (this is not) or trivial to convert (this should be). But I did put you one the spot 😆

Your extensions is technically correct but I think it might be somewhat academical. The no unit case only happens in single line mode of the value widget (height < 50, meaning 4 row layouts). This means the no unit case only happens on landscape radios because portrait radios show the value widget with separate lines for label and value (width is always > 50). But on landscape radios the width is always >= 120. Or can you think of a situation where the width is < 120 in single line mode?

Btw: Due to the fact portrait radios always show units (because height > 50, two lines) they are clipped if the value is to long (which I think is more acceptable than generally showing no units). One more argument against your commit. Better display units and clip them if there's not enough space rather than not displaying units at all.

image

Anyhow, thanks for looking into this.

PS: I don't mind being on the spot but you asked for 2.10.6 and a main PR couldn't be cherry picked ...

@pfeerick
Copy link
Member

pfeerick commented Jan 22, 2025

But on landscape radios the width is always >= 120. Or can you think of a situation where the width is < 120 in single line mode?

And what happens if/when a three column layout is added?

Btw: Due to the fact portrait radios always show units (because height > 50, two lines) they are clipped if the value is to long (which I think is more acceptable than generally showing no units). One more argument against your commit.

Which is exactly why I did it that way... it should not trigger on 320x480 radios, since the width is only checked if height() < 50. Good enough for 2.10. For main, really should consider checking the length of value being displayed and dropping the unit if too long, but not sure if I can really be bothered going that far. Starting to get into the territory of marquee/scrolling to fit to small a space....

@mha1
Copy link
Contributor Author

mha1 commented Jan 22, 2025

And what happens if/when a three column layout is added?

It'd clip the display just as it does now on NV14. Yeah, best would be to decide if the unit fits and only display it if it does. Second best is to show the units in any case and clip it, worst is to not show it at all.

@3djc
Copy link
Collaborator

3djc commented Jan 22, 2025

I think clipping is worst that not displaying unit, which you usually know very well anyway

@mha1
Copy link
Contributor Author

mha1 commented Jan 22, 2025

I think clipping is worst that not displaying unit, which you usually know very well anyway

I was assisting a beginner. He wasn't happy because the labels are not very explicit. After explaining RxBt it was clear it is a voltage but it required explaining.

And clipping would not happen in most of the cases. Not doing clipping in favor of no unit would just throw away a lot of good displays in favor of maybe one or two potentially too long readings.

@pfeerick
Copy link
Member

pfeerick commented Jan 22, 2025 via email

@pfeerick pfeerick force-pushed the PR_UnitsForValueWidgetIn4RowLayoutToo branch from d72a49c to 2f126df Compare January 22, 2025 21:39
@pfeerick pfeerick changed the title fix(color): value widget should show units if enough width - 2.10 fix(color): attempt to show units for value widget if height < 50 - 2.10 Jan 22, 2025
@pfeerick pfeerick merged commit f9bcba3 into EdgeTX:2.10 Jan 22, 2025
94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working color Related generally to color LCD radios widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants