[0.17.13] sprite-button ignore icon_horizontal_align

Bugs that are actually features.
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 720
Joined: Sun Nov 23, 2014 11:57 am
Contact:

[0.17.13] sprite-button ignore icon_horizontal_align

Post by Earendel »

It seems like there's problem with the mod api ability to create buttons.

Example:

Code: Select all

/c game.player.gui.center.add{type="sprite-button", sprite="item.iron-plate", name = "a2", caption ="a2", style="map_generator_preview_button"}
This creates a button where the icon is centered despite the style having the setting: icon_horizontal_align = "left"
This is not the same as the real map preview button which has the icon on the left.

I would like to be able to have the icon and the caption left aligned but the icon before the caption, not overlapping.

I can't find any other setting that can do the job, and trying to nest an image in a flow in a button does not work with automatic ui-scaling, it doesn't seem to be possible to get the positioning correct at multiple ui scales.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16101
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.13] sprite-button ignore icon_horizontal_align

Post by Rseding91 »

Thanks for the report. I'm not sure if this is a bug. The style property "icon_horizontal_align" is only used by the IconButton type which isn't exposed in the mod API. The sprite button doesn't use the concept of "icons" so I don't know if it even makes sense to have it pay attention to that style property.

IconButton uses button_style but only so we don't have to duplicate all of the styles/logic from buttons.

For now I'm going to say this is working as intended. SpriteButton != IconButton and as such SpriteButton pays no attention to style properties added for use by IconButton.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”