mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fix missing or crushed group and pile-by buttons in narrow layouts
This commit is contained in:
@@ -1132,13 +1132,15 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getPileByWidth() {
|
public float getPileByWidth() {
|
||||||
if (cbxSortOptions != null) {
|
|
||||||
return cbxSortOptions.getWidth();
|
|
||||||
}
|
|
||||||
if (filters.get().isEmpty()) {
|
if (filters.get().isEmpty()) {
|
||||||
return 0f;
|
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
|
@Override
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
btnExpandCollapseAll.setBounds(x, y, h, h);
|
btnExpandCollapseAll.setBounds(x, y, h, h);
|
||||||
x += h + padding;
|
x += h + padding;
|
||||||
|
|
||||||
float pileByWidth = itemManager.getPileByWidth();
|
float pileByWidth = Math.min(itemManager.getPileByWidth(), (width - x - padding) / 2.0f);
|
||||||
float groupByWidth = width - x - padding - pileByWidth;
|
float groupByWidth = width - x - padding - pileByWidth;
|
||||||
|
|
||||||
cbGroupByOptions.setBounds(x, y, groupByWidth, h);
|
cbGroupByOptions.setBounds(x, y, groupByWidth, h);
|
||||||
|
|||||||
Reference in New Issue
Block a user