mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Change Vanguard to use list view by default
This commit is contained in:
@@ -61,6 +61,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
|
||||
private final List<Integer> selectedIndices = new ArrayList<Integer>();
|
||||
private int columnCount = 4;
|
||||
private float scrollHeight = 0;
|
||||
private ColumnDef pileBy = null;
|
||||
private GroupDef groupBy = null;
|
||||
private ItemInfo focalItem;
|
||||
@@ -529,6 +530,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
group.setBounds(groupX, groupY, groupWidth, y - groupY);
|
||||
y += PADDING;
|
||||
}
|
||||
scrollHeight = y;
|
||||
|
||||
if (forRefresh) { //refresh ordered items if needed
|
||||
int index = 0;
|
||||
@@ -551,7 +553,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
|
||||
@Override
|
||||
protected float getScrollHeight() {
|
||||
return groups.get(groups.size() - 1).getBottom() + PADDING;
|
||||
return scrollHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -776,8 +778,8 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
ItemInfo itemInfo = orderedItems.get(selectedIndices.get(0));
|
||||
Vector2 screenPos = itemInfo.group.getScreenPosition();
|
||||
Vector2 relPos = itemInfo.group.getChildRelativePosition(itemInfo);
|
||||
return new Rectangle(screenPos.x + relPos.x - SEL_BORDER_SIZE,
|
||||
screenPos.y + relPos.y - itemInfo.group.getTop() - SEL_BORDER_SIZE,
|
||||
return new Rectangle(screenPos.x + relPos.x - SEL_BORDER_SIZE + itemInfo.group.getLeft(),
|
||||
screenPos.y + relPos.y - SEL_BORDER_SIZE,
|
||||
itemInfo.getWidth() + 2 * SEL_BORDER_SIZE, itemInfo.getHeight() + 2 * SEL_BORDER_SIZE);
|
||||
}
|
||||
|
||||
@@ -849,7 +851,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
if (items.isEmpty()) { return; }
|
||||
|
||||
final float visibleTop = getScrollValue();
|
||||
final float visibleBottom = visibleTop + getHeight();
|
||||
final float visibleBottom = visibleTop + getScroller().getHeight();
|
||||
for (ItemInfo itemInfo : items) {
|
||||
if (itemInfo.getBottom() < visibleTop) {
|
||||
continue;
|
||||
@@ -890,8 +892,8 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
|
||||
//provide special override for this function to account for special ItemInfo positioning logic
|
||||
@Override
|
||||
public Vector2 getChildRelativePosition(FDisplayObject child) {
|
||||
return new Vector2(child.getLeft() - getScrollLeft(), child.getTop() - getScrollValue());
|
||||
protected Vector2 getChildRelativePosition(FDisplayObject child, float offsetX, float offsetY) {
|
||||
return new Vector2(child.getLeft() - getScrollLeft() + offsetX - getLeft(), child.getTop() - getScrollValue() + offsetY - getTop());
|
||||
}
|
||||
}
|
||||
private class Pile extends FDisplayObject {
|
||||
|
||||
@@ -49,14 +49,19 @@ public abstract class ItemView<T extends InventoryItem> {
|
||||
@Override
|
||||
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
|
||||
onResize(visibleWidth, visibleHeight);
|
||||
//scroll selection into view whenever view height changes
|
||||
if (visibleHeight != heightBackup) {
|
||||
heightBackup = visibleHeight;
|
||||
scrollSelectionIntoView();
|
||||
}
|
||||
return new ScrollBounds(visibleWidth, ItemView.this.getScrollHeight());
|
||||
}
|
||||
|
||||
protected void setScrollPositionsAfterLayout(float scrollLeft0, float scrollTop0) {
|
||||
if (getHeight() != heightBackup) {
|
||||
heightBackup = getHeight();
|
||||
scrollSelectionIntoView(); //scroll selection into view whenever view height changes
|
||||
}
|
||||
else {
|
||||
super.setScrollPositionsAfterLayout(scrollLeft0, scrollTop0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tap(float x, float y, int count) {
|
||||
return ItemView.this.tap(x, y, count);
|
||||
|
||||
@@ -104,11 +104,11 @@ public abstract class FContainer extends FDisplayObject {
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 getChildRelativePosition(FDisplayObject child) {
|
||||
public final Vector2 getChildRelativePosition(FDisplayObject child) {
|
||||
return getChildRelativePosition(child, 0, 0);
|
||||
}
|
||||
|
||||
private Vector2 getChildRelativePosition(FDisplayObject child, float offsetX, float offsetY) {
|
||||
protected Vector2 getChildRelativePosition(FDisplayObject child, float offsetX, float offsetY) {
|
||||
for (FDisplayObject c : children) { //check direct children first
|
||||
if (child == c) {
|
||||
return new Vector2(c.getLeft() + offsetX, c.getTop() + offsetY);
|
||||
|
||||
@@ -130,7 +130,7 @@ public abstract class FScrollPane extends FContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doLayout(float width, float height) {
|
||||
protected void doLayout(float width, float height) {
|
||||
scrollBounds = layoutAndGetScrollBounds(width, height);
|
||||
scrollBounds.increaseWidthTo(width); //ensure scroll bounds extends at least to visible bounds
|
||||
scrollBounds.increaseHeightTo(height);
|
||||
|
||||
@@ -67,7 +67,7 @@ public enum ItemManagerConfig {
|
||||
SCHEME_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
|
||||
null, null, 3, 0),
|
||||
VANGUARDS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, true,
|
||||
null, null, 3, 1),
|
||||
null, null, 3, 0),
|
||||
DRAFT_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
|
||||
null, null, 3, 0),
|
||||
SEALED_DECKS(SColumnUtil.getDecksDefaultColumns(true, false), false, false, false,
|
||||
|
||||
Reference in New Issue
Block a user