[0.16.30] Gui Label maximal_height clipping

Bugs that we were not able to reproduce, and/or are waiting for more detailed info.
Post Reply
Oarc
Fast Inserter
Fast Inserter
Posts: 100
Joined: Sun Sep 18, 2016 2:04 pm
Contact:

[0.16.30] Gui Label maximal_height clipping

Post 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
Attachments
text_label_clipping.PNG
text_label_clipping.PNG (105.18 KiB) Viewed 1933 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.30] Gui Label maximal_height clipping

Post 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?
If you want to get ahold of me I'm almost always on Discord.

Oarc
Fast Inserter
Fast Inserter
Posts: 100
Joined: Sun Sep 18, 2016 2:04 pm
Contact:

Re: [0.16.30] Gui Label maximal_height clipping

Post 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)

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: [0.16.30] Gui Label maximal_height clipping

Post 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..
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.30] Gui Label maximal_height clipping

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: [0.16.30] Gui Label maximal_height clipping

Post 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.
Attachments
Screenshot_5.png
Screenshot_5.png (2 KiB) Viewed 1805 times
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: [0.16.30] Gui Label maximal_height clipping

Post 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.
Attachments
demo.png
demo.png (60.76 KiB) Viewed 1801 times
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

Post Reply

Return to “Pending”