mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Update revealed panel in hand when card zoom closed
This commit is contained in:
@@ -55,25 +55,38 @@ public class VZoneDisplay extends VCardDisplayArea {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idx >= 0) { //cascade cards back from revealed panel
|
||||
clearChildren();
|
||||
int maxIdx = cardPanels.size() - 1;
|
||||
int offset = Math.max(idx, maxIdx - idx);
|
||||
for (int i = offset; i > 0; i--) {
|
||||
int idx1 = idx - i;
|
||||
int idx2 = idx + i;
|
||||
if (idx1 >= 0) {
|
||||
add(cardPanels.get(idx1));
|
||||
}
|
||||
if (idx2 <= maxIdx) {
|
||||
add(cardPanels.get(idx2));
|
||||
}
|
||||
}
|
||||
revealedPanel = cardPanels.get(idx);
|
||||
add(revealedPanel);
|
||||
if (idx >= 0) {
|
||||
setRevealedPanel(idx);
|
||||
}
|
||||
}
|
||||
|
||||
private void setRevealedPanel(int idx) {
|
||||
//cascade cards back from revealed panel
|
||||
clearChildren();
|
||||
int maxIdx = cardPanels.size() - 1;
|
||||
int offset = Math.max(idx, maxIdx - idx);
|
||||
for (int i = offset; i > 0; i--) {
|
||||
int idx1 = idx - i;
|
||||
int idx2 = idx + i;
|
||||
if (idx1 >= 0) {
|
||||
add(cardPanels.get(idx1));
|
||||
}
|
||||
if (idx2 <= maxIdx) {
|
||||
add(cardPanels.get(idx2));
|
||||
}
|
||||
}
|
||||
revealedPanel = cardPanels.get(idx);
|
||||
add(revealedPanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedIndex(int index) {
|
||||
if (revealedPanel == null) {
|
||||
super.setSelectedIndex(index);
|
||||
}
|
||||
setRevealedPanel(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
revealedPanel = null;
|
||||
|
||||
Reference in New Issue
Block a user