Update revealed panel in hand when card zoom closed

This commit is contained in:
drdev
2015-04-10 20:58:48 +00:00
parent fba0ae22f1
commit e669f4038e

View File

@@ -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;