What does "scalable" in style prototype do?

Place to get help with not working mods / modding interface.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1197
Joined: Wed May 18, 2016 4:55 pm
Contact:

What does "scalable" in style prototype do?

Post by Mooncat »

Hi, everyone,

Does anyone know what does the "scalable" property in style prototype actually do?

During the last update of my Color Picker mod, I added the Hex field under the RGB fields. The UI alignment nearly drove me nuts. It spent me most of the time to fix the alignment so I can capture a nice screenshot for publish.

But, less than a minute after I clicked the submit button, I realized the alignment is complete wrong if I resize the Factorio's window (I play in windowed mode). It becomes this when Factorio is in fullscreen:
Before
<<Insert multiple GIFs from Factorio development explained in gifs>>

Then I spent hours trying to fix this problem. The solution I came up with is to spam "scalable = false" in the style prototypes. Now, the alignment looks really good. It doesn't change no matter how I resize Factorio's window.
After
Therefore, I wonder why "scalable = false" is not the default value. Do I lose something if I set it to false?
I know it has nothing to do with Options - UI Scale. But is my solution safe?

Edit: I decided to release the fixed version first. So, the alignment problem was in Color Picker v0.2.0, and it is fixed in v0.2.1.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: What does "scalable" in style prototype do?

Post by aubergine18 »

Which styles have you tested the scalable property with? I've only ever seen it mentioned in button_style prototypes and though originally that it was something to do with making button scale to fit its caption or sprite, but looking at your stuff above it seems it's more about making UI elements not scale with window size changes...
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1197
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: What does "scalable" in style prototype do?

Post by Mooncat »

buttons, labels, textfields, flows (maybe unnecessary), tabels (unnecessary either?)
Basically, everything except the frame.

Yea, I thought it is about button size only too when I first saw this property. But turns out it is not. :?
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: What does "scalable" in style prototype do?

Post by aubergine18 »

I'll add it to all non-flow/frame style types in the Style mod and have it default to true for container elements and false for all others.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Post Reply

Return to “Modding help”