[kovarex] [0.17.17][modding, guiStyles] Flow that is part of a frame doesn't look at vertical_spacing
Posted: Fri Mar 22, 2019 9:34 am
Hi,
I created a frame with direction set to 'vertical', meaning the gui creates a visible frame, with a vertical flow inside of it, as shown in the picture below. This frame element has a custom style called LSlib_default_tab_insideDeepFrame (reference to the inside_deep_frame_for_tab in base game).
Since the direction is set to vertical, it creates a vertical flow and so it uses the vertical_flow_style defined in the frame style for that flow.
When I log this style in after the data stage
It logs this:
As you can see, all the way at the bottom of the code snippet it says vertical_flow_style.vertical_spacing = 0. In my screenshot it shows a vertical_spacing of 8 (default frame vertical spacing of 4, but i'm on 200% ui scale, so it shows 8), meaning it's not looking at the vertical_flow_style.vertical_spacing while creating the flow, instead it just creates a flow with the default spacing.
This results in an undesired spacing between my UI elements as shown in the picture below:
I got a workaround by manualy adding a vertical flow in that frame and setting the style to "packed_vertical_flow", which is the vertical_flow with a vertical spacing of 0, resulting in the wanted behaviour:
I've uploaded the mod used in the screenshot as well. In data-final-fixes it still logs the used style and to open the UI, folow these steps:
lovely_santa
I created a frame with direction set to 'vertical', meaning the gui creates a visible frame, with a vertical flow inside of it, as shown in the picture below. This frame element has a custom style called LSlib_default_tab_insideDeepFrame (reference to the inside_deep_frame_for_tab in base game).
Since the direction is set to vertical, it creates a vertical flow and so it uses the vertical_flow_style defined in the frame style for that flow.
When I log this style in after the data stage
Code: Select all
log(serpent.block(data.raw["gui-style"]["default"]["LSlib_default_tab_insideDeepFrame"]))
Code: Select all
3.117 Script @__trainConstructionSite__/data-final-fixes.lua:1: {
border = {},
bottom_padding = 4,
flow_style = {
type = "flow_style"
},
font = "heading-1",
font_color = {
255,
230,
192
},
graphical_set = {
base = {
center = {
position = {
42,
8
},
size = {
1,
1
}
},
corner_size = 8,
draw_type = "outer",
position = {
17,
0
}
},
shadow = {
corner_size = 8,
draw_type = "inner",
position = {
183,
128
},
scale = 0.5,
tint = {
0,
0,
0,
1
}
}
},
header_filler_style = {
height = 24,
parent = "draggable_space_header",
type = "empty_widget_style"
},
header_flow_style = {
maximal_height = 24,
type = "horizontal_flow_style",
vertical_align = "center"
},
horizontal_flow_style = {
type = "horizontal_flow_style"
},
left_padding = 8,
name = "LSlib_default_tab_insideDeepFrame",
padding = 0,
right_padding = 8,
title_bottom_padding = 6,
title_left_padding = 0,
title_right_padding = 0,
title_top_padding = -2,
top_padding = 12,
type = "frame_style",
use_header_filler = true,
vertical_flow_style = {
type = "vertical_flow_style",
vertical_spacing = 0
}
}
This results in an undesired spacing between my UI elements as shown in the picture below:
I got a workaround by manualy adding a vertical flow in that frame and setting the style to "packed_vertical_flow", which is the vertical_flow with a vertical spacing of 0, resulting in the wanted behaviour:
I've uploaded the mod used in the screenshot as well. In data-final-fixes it still logs the used style and to open the UI, folow these steps:
- Start a new game
- Out of your inventory place a 'rail'
- Out of your inventory place a 'traindepo' next to that rail (item is located right if the rail item in the inventory)
- Open the 'traindepo' entity like you would open a 'train-stop'
lovely_santa