Creating a switch type gui element with labels overrides the width of the labels. No matter what i try it seems impossible to create a switch with fixed-width labels.
Explanation
After going through a small odyssey trying to create a column of aligned switches and writing down the lengthy lua-side reimplementation i came to the conclusion that that switch style label behavior makes no sense.
So i was trying to fix this horrible zig-zag:
The only way i can think of to align the switches is to make the labels fixed width.
I tried overwriting the switches label style properties one-by-one, trying anything that seemed related to width.
Code: Select all
local styles = data.raw['gui-style'].default
styles.test_switch_style = util.table.deepcopy(styles.switch)
local il = styles.test_switch_style.inactive_label
local switch_label_width = 70
-- il. width = switch_label_width
il. horizontally_stretchable = 'off'
il. horizontally_squashable = 'on'
-- il. size = {switch_label_width,24}
-- il. minimal_width = switch_label_width
il. maximal_width = switch_label_width
-- il. natural_width = switch_label_width
-- il. maximum_horizontal_squash_size = switch_label_width
But no matter what i try i can not make the labels wider, only smaller.