mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Fixed card highlighting
* Changed CardPanelRenderImpl to correctly invalidate its render when its panel has its isChoosable / isSelected override set. Before things like selecting cards in a draft view would not visibly have an effect as the render wasn't invalidated.
This commit is contained in:
parent
f9e088b51d
commit
0ea9d33211
2 changed files with 26 additions and 5 deletions
|
@ -377,6 +377,24 @@ public class CardPanelRenderImpl extends CardPanel {
|
|||
return ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(boolean selected) {
|
||||
if (selected != isSelected()) {
|
||||
super.setSelected(selected);
|
||||
// Invalidate our render
|
||||
cardImage = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChoosable(boolean choosable) {
|
||||
if (choosable != isChoosable()) {
|
||||
super.setChoosable(choosable);
|
||||
// Invalidate our render
|
||||
cardImage = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getImage() {
|
||||
|
|
|
@ -227,10 +227,6 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
|
||||
@Override
|
||||
protected void drawBorder(Graphics2D g) {
|
||||
// Draw border as one rounded rectangle
|
||||
g.setColor(Color.black);
|
||||
g.fillRoundRect(0, 0, cardWidth, cardHeight, cornerRadius, cornerRadius);
|
||||
|
||||
// Selection Borders
|
||||
Color borderColor;
|
||||
if (isSelected) {
|
||||
|
@ -242,8 +238,14 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
} else if (cardView instanceof PermanentView && ((PermanentView) cardView).isCanAttack()) {
|
||||
borderColor = new Color(0, 0, 255, 230);
|
||||
} else {
|
||||
borderColor = null;
|
||||
borderColor = Color.BLACK;
|
||||
}
|
||||
|
||||
// Draw border as one rounded rectangle
|
||||
g.setColor(borderColor);
|
||||
g.fillRoundRect(0, 0, cardWidth, cardHeight, cornerRadius, cornerRadius);
|
||||
|
||||
/* // Separate selection highlight border from card itself. Not used right now
|
||||
if (borderColor != null) {
|
||||
float hwidth = borderWidth / 2.0f;
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
|
@ -257,6 +259,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
g2.draw(rect);
|
||||
g2.dispose();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue