[kovarex] [0.18.27] Table spacing issue

Bugs that we were not able to reproduce, and/or are waiting for more detailed info.
Post Reply
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

[kovarex] [0.18.27] Table spacing issue

Post by bobingabout »

In my classes mod, there is this line to draw a table

Code: Select all

    gui.add{type = "table", column_count = 6, name = "table", style = "slot_table", draw_horizontal_lines = true, draw_vertical_lines = false}
The error specifically relates to the draw_horizontal_lines = true tag (it may effect vertical too, I'm just reporting my own bug here, not trying every feature)
Basically, from what I can tell, in the old system (Before 0.18.27) a space was given the width of the line it was drawing (so, 1 pixel) in the new system, there is no space given, but the lines still assume there is.
This leads to the visual error where the lines don't line up with the rows anymore.

Screenshot before: https://www.dropbox.com/s/gk7wn3xmkcj2n ... 2.png?dl=0
Screenshot now: https://www.dropbox.com/s/2o5q86khxvpet ... 1.png?dl=0

There seems to be less spacing around all the objects too, which makes it look visually different, but that could be fixed by tweaking styles.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [0.18.27] Table spacing issue

Post by bobingabout »

Update:

I changed style from "slot_table" to "compact_slot_table", which changes it to give it the 2 pixel spacing in both directions.
This fixes the line placement issue, so it seems that the draw_horizontal_lines issue is specifically when vertical_spacing = 0
Might not be a new bug if that's the case.


Unrelated note: with the mod-gui buttons being placed inside a table with spacing 0, they look like they're all merged into one big button: https://www.dropbox.com/s/ynnx6xp7dzast ... 8.png?dl=0
That's the built in mod-gui we were told to add buttons to on top GUI
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.18.27] Table spacing issue

Post by Klonan »

bobingabout wrote:
Tue May 26, 2020 5:32 pm
Update:

I changed style from "slot_table" to "compact_slot_table", which changes it to give it the 2 pixel spacing in both directions.
This fixes the line placement issue, so it seems that the draw_horizontal_lines issue is specifically when vertical_spacing = 0
Might not be a new bug if that's the case.


Unrelated note: with the mod-gui buttons being placed inside a table with spacing 0, they look like they're all merged into one big button: https://www.dropbox.com/s/ynnx6xp7dzast ... 8.png?dl=0
That's the built in mod-gui we were told to add buttons to on top GUI
It works for me
Image

What script/mod are you adding the buttons with?

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [0.18.27] Table spacing issue

Post by bobingabout »

Klonan wrote:
Wed May 27, 2020 3:22 pm
bobingabout wrote:
Tue May 26, 2020 5:32 pm
Update:

I changed style from "slot_table" to "compact_slot_table", which changes it to give it the 2 pixel spacing in both directions.
This fixes the line placement issue, so it seems that the draw_horizontal_lines issue is specifically when vertical_spacing = 0
Might not be a new bug if that's the case.


Unrelated note: with the mod-gui buttons being placed inside a table with spacing 0, they look like they're all merged into one big button: https://www.dropbox.com/s/ynnx6xp7dzast ... 8.png?dl=0
That's the built in mod-gui we were told to add buttons to on top GUI
It works for me
Image

What script/mod are you adding the buttons with?
The mods of mine that add the buttons there are... Classes (The one linked to originally) and Inserters.
But this is a line that does it:

Code: Select all

  mod_gui.get_button_flow(player).add{type = "sprite-button", name = "bob_logistics_inserter_button", tooltip = {"gui.bob-inserter-open-gui"}, sprite = "item/fast-inserter", style = "mod_gui_button"}
not to forget this at the top of the file:

Code: Select all

require("mod-gui")
If you look back at the screenshot I printed, it's the one that looks like a fast inserter, which is right next to the rocket silo button... Yes, I just copied what the rocket silo button from base game.
Somehow, your buttons do seem to have a bit more space between them than mine do, even though all the used styles I used are from the base game. (Heck, I think that's even the same style you're using.)

Either way, this wasn't the actual bug report, just something semi-related that was bugging me.
The actual bug report is that draw_horizontal_lines = true draws lines in the wrong place when vertical_spacing = 0 (And likely, but untested, the same thing for draw_vertical_lines = true when horizontal_spacing = 0)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.18.27] Table spacing issue

Post by Klonan »

Can you provide a simpler snippet to reproduce the problem? like a small 1 line console command that we can paste in?

Your mod is defining styles in prototypes and it makes it a pain to try to reproduce the issue

In the base game, we no longer use the 'draw_horizontal_lines' features,
I would suggest using the new border styles, such as 'bordered_table', as they are much better supported and look much nicer

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [0.18.27] Table spacing issue

Post by bobingabout »

Klonan wrote:
Tue Oct 20, 2020 5:21 pm
Can you provide a simpler snippet to reproduce the problem? like a small 1 line console command that we can paste in?

Your mod is defining styles in prototypes and it makes it a pain to try to reproduce the issue

In the base game, we no longer use the 'draw_horizontal_lines' features,
I would suggest using the new border styles, such as 'bordered_table', as they are much better supported and look much nicer
Sorry for not responding sooner, I've not really been paying much attention to Factorio since the 1.0 release.
I got around the issue myself just by changing the style a little.

The issue seems to specifically be the draw_horizontal_lines when vertical_spacing = 0
So, looking up some styles for this.
Style slot_table has a spacing of 0, but compact_slot_table has a spacing of 2
If you use the compact (which is less compact) version, it draws correctly, if you use the standard version, it draws wrong.

Here is a command as requested to just draw a table in the middle of the screen. just change the style and redraw it (don't forget to delete it first, or start a new game)

Code: Select all

/c game.player.gui.center.add{type = "frame", name = "testframe", direction = "vertical"}
game.player.gui.center.testframe.add{type = "table", column_count = 1, name = "testtable", style = "slot_table", draw_horizontal_lines = true, draw_vertical_lines = false}
for i=1,10 do
  game.player.gui.center.testframe.testtable.add{type = "label", name = "test" .. i, caption = "test" .. i}
end
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Pending”