Style.margin/padding doesn't work correctly on switches

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Factorio Staff
Factorio Staff
Posts: 208
Joined: Tue Dec 11, 2018 2:10 pm

Style.margin/padding doesn't work correctly on switches

Post by Therenas »

At least, I think it doesn't. When setting margin/padding on switches, it applies it to the switch button itself, and not the whole element, including its labels. The following code demonstrates this (change margin for padding to see both things):

Code: Select all

local frame = player.gui.screen.add{type="frame"}
local switch = frame.add{type="switch", switch_state="left", left_label_caption="ON", right_label_caption="OFF"} = 30
When setting a margin, it looks like this, when setting padding, like this. What I think it should do with margin is shift the whole element to the right, including labels, instead of move the button away from its label. For padding, I'm not 100% sure what it should do, but what it does currently is not super useful I think. I'm open to being wrong about this ofc, there might be a reason for why it is like this.

Post Reply

Return to “Modding interface requests”