Skip to content

Comments

Bug - Bag Cell Layout is Inconsistent#874

Merged
Cidan merged 5 commits intoCidan:mainfrom
gengariczek:bug/bag_cell_layout_inconsistent
Feb 16, 2026
Merged

Bug - Bag Cell Layout is Inconsistent#874
Cidan merged 5 commits intoCidan:mainfrom
gengariczek:bug/bag_cell_layout_inconsistent

Conversation

@gengariczek
Copy link
Contributor

@gengariczek gengariczek commented Feb 2, 2026

There are several issues with how cells are distributed into columns in bags and banks. With extra large groups, it is very easy to see. I'm fixing all the issues that I found related to this.

  • When one cell's height is larger than how large the column would be if we simply divide totalHeight / columnCount, we can use this height instead. This avoids unnecessary columns.
  • First cell in the bag and first cell in each column is ignored when calculating. This would cause uneven columns, especially when said cell is large.
    • Correctly account for width and height.
  • Some totals were missing spacing in one loop and not in the other.
    • I made sure the loops calculate width in the same way.
    • If this is a feature, then spacing should be ignored in both loops.
  • Conditions ignore spacing.
    • I did not change this as it seems to be a feature.

@gengariczek
Copy link
Contributor Author

gengariczek commented Feb 2, 2026

Bag and bank columns = 4
Before:
image
After:
image

@gengariczek
Copy link
Contributor Author

gengariczek commented Feb 2, 2026

Actually, I see that now an extra column can appear. I saw this issue some time ago. The algorithm doesn't check for the final number of columns, which is now a more pronounced problem.

Let me see what else can be improved.

@gengariczek
Copy link
Contributor Author

gengariczek commented Feb 2, 2026

Fixed the extra columns and now the balancing works pretty well even with a large bank.
Bag and bank columns = 4

Before:
image
After:
image

@gengariczek
Copy link
Contributor Author

@Cidan Please check my code. I am new to LUA.

In practice it seems to be working well, I did not get any exceptions. I did not observe any performance changes.

In the future, it would be nice to be able to split gigantic cells into two columns (so it doesn't grow outside of the monitor :) ), but that is a corner case which barely affects anyone (and I definitely do not dare attempting fixing that).

@Cidan
Copy link
Owner

Cidan commented Feb 16, 2026

Checking frames/grid.lua                          2 warnings

    frames/grid.lua:351:9: (W143) accessing undefined field Log of global debug
    frames/grid.lua:357:7: (W311) value assigned to variable columns is unused

please fix

@Cidan Cidan merged commit 1d71186 into Cidan:main Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants