Fix missing or crushed group and pile-by buttons in narrow layouts

This commit is contained in:
Jetz
2025-08-17 20:52:21 -04:00
parent 5a3e55f704
commit 70f6bcb63c
2 changed files with 7 additions and 5 deletions

View File

@@ -1132,13 +1132,15 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
}
public float getPileByWidth() {
if (cbxSortOptions != null) {
return cbxSortOptions.getWidth();
}
if (filters.get().isEmpty()) {
return 0f;
}
return filters.get().get(filters.get().size() - 1).getWidget().getWidth();
float preferredSize = filters.get().get(filters.get().size() - 1).getWidget().getWidth();
if (cbxSortOptions != null && Math.abs(1 - (cbxSortOptions.getWidth() / preferredSize)) < 0.25) {
//Match the size of the sort box if it's not too far off from what we'd prefer.
return cbxSortOptions.getWidth();
}
return preferredSize;
}
@Override

View File

@@ -413,7 +413,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
btnExpandCollapseAll.setBounds(x, y, h, h);
x += h + padding;
float pileByWidth = itemManager.getPileByWidth();
float pileByWidth = Math.min(itemManager.getPileByWidth(), (width - x - padding) / 2.0f);
float groupByWidth = width - x - padding - pileByWidth;
cbGroupByOptions.setBounds(x, y, groupByWidth, h);