mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08: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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (idx >= 0) { //cascade cards back from revealed panel
|
if (idx >= 0) {
|
||||||
clearChildren();
|
setRevealedPanel(idx);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
revealedPanel = null;
|
revealedPanel = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user