Page 1 of 1
[0.16.30] Gui Label maximal_height clipping
Posted: Thu Mar 15, 2018 10:05 pm
by Oarc
I'm not sure if this is a bug, but I couldn't find a note in the recent change logs that mention any changes like this.
I used to use maximal_height=10 to have multiple labels arranged vertically closer together.
The default spacing between labels is very large.
I tried playing with padding and setting heights but I can no longer get the desired spacing due to clipping.
I attached a picture of what it looks like since one of the recent patches. I think this change happened in .27 or maybe .28?
Thanks,
Oarc
Re: [0.16.30] Gui Label maximal_height clipping
Posted: Fri Mar 16, 2018 1:30 am
by Rseding91
Can you please post a sample mod that shows the issue?
Also, why not just set a single label to be multi-line and use that instead of multiple labels?
Re: [0.16.30] Gui Label maximal_height clipping
Posted: Fri Mar 16, 2018 3:49 pm
by Oarc
How do I do a multi-line label?
I'm looking at this and can't figure it out: http://lua-api.factorio.com/latest/LuaGuiElement.html
I see multi-line for text-boxes but I'm not sure how to do that for a label.
(I got pointed to
viewtopic.php?p=349133#p349133 which says to set single_line to false.
http://lua-api.factorio.com/latest/LuaS ... ingle_line. Thanks!)
Here's an example. I'm doing this in my scenario code, I don't know how to make a mod.
Code: Select all
script.on_event(defines.events.on_player_joined_game, function(event)
local player = game.players[event.player_index]
player.gui.center.add{name = "test_msg",
type = "frame",
direction = "vertical",
caption="test GUI height clipping issues"}
local tGui = player.gui.center.test_msg
tGui.style.maximal_width = 200
tGui.style.maximal_height = 100
tGui.add{name = "lable_1", type = "label",
caption="A test message blah blah blah blah blah message blah blah blah blah blah."}
tGui.add{name = "lable_2", type = "label",
caption="A test message blah blah blah blah blah message blah blah blah blah blah."}
tGui.add{name = "lable_3", type = "label",
caption="A test message blah blah blah blah blah message blah blah blah blah blah."}
tGui.lable_1.style.maximal_height=10
tGui.lable_2.style.maximal_height=10
tGui.lable_3.style.maximal_height=10
end)
Re: [0.16.30] Gui Label maximal_height clipping
Posted: Wed Aug 15, 2018 4:03 am
by ownlyme
yeah i have the same issue.
it looks like the label leaves a ton of space on the top.
when i set mine to 6-8 px height i don't even see any text..
Re: [0.16.30] Gui Label maximal_height clipping
Posted: Wed Aug 15, 2018 5:06 am
by Rseding91
ownlyme wrote:yeah i have the same issue.
it looks like the label leaves a ton of space on the top.
when i set mine to 6-8 px height i don't even see any text..
That's because the font defines the minimum height to render it and that's the height you see.
Re: [0.16.30] Gui Label maximal_height clipping
Posted: Wed Aug 15, 2018 6:12 pm
by ownlyme
big part of the problem is that the font scales with window size, regardless of the "scaleable" property.
look at my graph. the spacers above the texts are 0 px height (triple checked!), yet there are huge gaps above them (texts have huge top-padding inside the label.)
i've tried everything but there is no way to fix it.
Re: [0.16.30] Gui Label maximal_height clipping
Posted: Wed Aug 15, 2018 6:46 pm
by ownlyme
try this:
/c frame = game.players[1].gui.left.add{type = "frame", name = "frame", caption = "", direction = "vertical"}
tbl = frame.add{type = "table", column_count=1, name = "tbl", direction = "vertical"}
tbl.style.vertical_spacing=0
tbl.style.scaleable = false
above=tbl.add{type = "progressbar", name = "above", direction = "vertical"}
above.style.height = 1
above.value = 1
above.style.scaleable = false
textbox = tbl.add{type = "label", name = "textbox", direction = "vertical"}
textbox.style.height = 12
textbox.caption="12345%"
textbox.style.font = "default-small-bold"
textbox.style.scaleable = false
(paste the whole block into console^^)
i attached the result you should see.