From b78dab27a16b1bfc601179907da157e7a24134f1 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 18 Nov 2017 16:44:34 +0400 Subject: [PATCH] Little fix to always show icons and names for cards without images. --- .../org/mage/card/arcane/CardPanelComponentImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java index 2002dc06a3d..311e1dd9692 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java @@ -182,8 +182,11 @@ public class CardPanelComponentImpl extends CardPanel { IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap((Function) key -> createImage(key))); } - static private boolean canShowCardIcons(int fullWidth){ - return (fullWidth > 60) && (fullWidth < 200); + static private boolean canShowCardIcons(int cardFullWidth, boolean cardHasImage){ + // cards without images show icons and text always + // TODO: apply "card names on card" setting to icon too? + // TODO: fix card min-max size to hide (compare to settings size, not direct 60 and 200) + return ((cardFullWidth > 60) && (cardFullWidth < 200)) || (!cardHasImage); } private static class CardSizes{ @@ -474,7 +477,7 @@ public class CardPanelComponentImpl extends CardPanel { g.drawRect(ptText.getX(), ptText.getY(), ptText.getBounds().width, ptText.getBounds().height); //*/ - if (getShowCastingCost() && !isAnimationPanel() && canShowCardIcons(getCardWidth())) { + if (getShowCastingCost() && !isAnimationPanel() && canShowCardIcons(getCardWidth(), hasImage)) { String manaCost = ManaSymbols.getStringManaCost(gameCard.getManaCost()); int manaWidth = getManaWidth(manaCost); @@ -562,7 +565,7 @@ public class CardPanelComponentImpl extends CardPanel { //int fontHeight = Math.round(cardHeight * (26f / 672)); //boolean showText = (!isAnimationPanel() && fontHeight < 12); - boolean showText = !isAnimationPanel() && canShowCardIcons(cardWidth); + boolean showText = !isAnimationPanel() && canShowCardIcons(cardWidth, hasImage); titleText.setVisible(showText); ptText.setVisible(showText); fullImageText.setVisible(fullImagePath != null);