Page 1 of 1

[kovarex] [0.17.14] Modded GUI components ignore scaling when style.width attribute is set

Posted: Mon Mar 18, 2019 3:27 pm
by eduran
Edit: Initial description was wrong, see post below.

When a modded UI element is hidden while players change their UI scaling setting, For GUI elements with style.width set to a specific value, the width of the element in question is not resized according to the interface scaling setting. When making the UI elements visible at a later point in time, they retain their incorrect scaling. At that point, the only way to enforce proper scaling is to destroy and rebuild them. Other properties like height or font size scale correctly.

Background:
LTN Tracker adds a UI that is closed most of the time. It is created once at the start of the game with the root element set to be invisible (via the .style.visible property). At that point, toggling the UI on and off in lua is as easy as setting a single property to true/false. This method worked perfectly in 0.16 and mostly still does. But 0.17 introduced the issue described above.

Some screenshots below. If needed I will code a minimal working example.
As intended.
As intended.
1.jpg (191.95 KiB) Viewed 3665 times
After UI scale setting was changed. Elements invisible during change highlighted with red boxes.
After UI scale setting was changed. Elements invisible during change highlighted with red boxes.
2.jpg (217.91 KiB) Viewed 3665 times

Re: [kovarex] [0.17.14] Modded GUI components ignore scaling when hidden

Posted: Thu Apr 11, 2019 8:18 am
by kovarex
Hello, I tried to reproduce it with single button:
/c game.player.gui.center.add{type="button", caption="Hello button with a really long text", name="button"}
/c game.player.gui.center.button.visible = false

// now I changed the UI scale to from 100% to 200%

/c game.player.gui.center.button.visible = true
And the button had correct size, I even tried to nest the button to a table, and still worked properly.

So there is slight possiblity that it was fixed by other changes (I doubt).
But having some easy way to reproduce it (ideally minimal case) would be very helpful, can you provide it please?

Re: [kovarex] [0.17.14] Modded GUI components ignore scaling when hidden

Posted: Thu Apr 11, 2019 8:42 am
by eduran
kovarex wrote:
Thu Apr 11, 2019 8:18 am
But having some easy way to reproduce it (ideally minimal case) would be very helpful, can you provide it please?
Took me a moment to reproduce. My initial description was wrong, the real cause is setting a specific width for the widget. Visibility has nothing to do with it. Sorry for the confusion.
/c game.player.gui.center.add{type="button", caption="Hello button with a really long text", name="button"}
/c game.player.gui.center.button.style.width = 230

// now I changed the UI scale to from 100% to 200%

Re: [kovarex] [0.17.14] Modded GUI components ignore scaling when style.width attribute is set

Posted: Thu Apr 11, 2019 9:50 am
by kovarex
Ok, thank you for the clarification, fixed for the next version.