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

This subforum contains all the issues which we already resolved.
Post Reply
eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

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

Post by eduran » Mon Mar 18, 2019 3:27 pm

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.
1.jpg
As intended.
1.jpg (191.95 KiB) Viewed 1979 times
2.jpg
After UI scale setting was changed. Elements invisible during change highlighted with red boxes.
2.jpg (217.91 KiB) Viewed 1979 times
Last edited by eduran on Thu Apr 11, 2019 8:45 am, edited 2 times in total.

kovarex
Factorio Staff
Factorio Staff
Posts: 7424
Joined: Wed Feb 06, 2013 12:00 am
Contact:

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

Post by kovarex » Thu Apr 11, 2019 8:18 am

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?

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

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

Post by eduran » Thu Apr 11, 2019 8:42 am

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%

kovarex
Factorio Staff
Factorio Staff
Posts: 7424
Joined: Wed Feb 06, 2013 12:00 am
Contact:

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

Post by kovarex » Thu Apr 11, 2019 9:50 am

Ok, thank you for the clarification, fixed for the next version.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users