GUI: fixed wrong background rendering of card's popup window (related to #12261), deleted un-used code;

This commit is contained in:
Oleg Agafonov 2024-05-20 23:19:41 +04:00
parent 492269c473
commit 1b5f8ce1af
4 changed files with 5 additions and 11 deletions

View file

@ -438,7 +438,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
return; return;
} }
cardInfoPane.setLocation(40, 40); cardInfoPane.setLocation(40, 40);
cardInfoPane.setBackground(new Color(0, 0, 0, 0)); cardInfoPane.setBackground(new Color(0, 0, 0, 255)); // use non-transparent background to full draw, see bug example in #12261
UI.addComponent(MageComponents.CARD_INFO_PANE, cardInfoPane); UI.addComponent(MageComponents.CARD_INFO_PANE, cardInfoPane);
MageRoundPane popupContainer = new MageRoundPane(); MageRoundPane popupContainer = new MageRoundPane();

View file

@ -79,6 +79,7 @@ public final class UI {
if (true) return; if (true) return;
// TODO: wtf, is it used to display images by url?! Remove that code after few releases if no bug reports, 27.11.2023 // TODO: wtf, is it used to display images by url?! Remove that code after few releases if no bug reports, 27.11.2023
// TODO: is it place to implement emoji?
editorPane.getDocument().putProperty("imageCache", imageCache); // Read internally by ImageView, but never written. editorPane.getDocument().putProperty("imageCache", imageCache); // Read internally by ImageView, but never written.
editorPane.setEditorKit(new HTMLEditorKit() { editorPane.setEditorKit(new HTMLEditorKit() {
private static final long serialVersionUID = -54602188235105448L; private static final long serialVersionUID = -54602188235105448L;

View file

@ -24,7 +24,6 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
public static final int TOOLTIP_BORDER_WIDTH = 80; public static final int TOOLTIP_BORDER_WIDTH = 80;
private CardView currentCard;
private int type; private int type;
private int addWidth; private int addWidth;
@ -51,8 +50,6 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
@Override @Override
public void setCard(final CardView card, final Component container) { public void setCard(final CardView card, final Component container) {
currentCard = card;
try { try {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card); TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card);
@ -68,6 +65,7 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
} }
private void resizeTooltipIfNeeded(Component container, int ruleLength, int rules) { private void resizeTooltipIfNeeded(Component container, int ruleLength, int rules) {
// TODO: fix bug with long image path here?
if (container == null) { if (container == null) {
return; return;
} }
@ -97,9 +95,4 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
addHeight + TOOLTIP_HEIGHT_MIN); addHeight + TOOLTIP_HEIGHT_MIN);
} }
} }
@Override
public boolean isCurrentCard(CardView card) {
return currentCard != null && currentCard.equals(card);
}
} }

View file

@ -5,7 +5,7 @@ import mage.view.CardView;
import java.awt.*; import java.awt.*;
/** /**
* Card info pane for displaying card rules. * GUI: card info pane for displaying card rules.
* Supports drawing mana symbols. * Supports drawing mana symbols.
* *
* @author nantuko * @author nantuko
@ -13,5 +13,5 @@ import java.awt.*;
public interface CardInfoPane { public interface CardInfoPane {
void setCard(CardView card, Component container); void setCard(CardView card, Component container);
boolean isCurrentCard (CardView card);
} }