mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Fixed that card name text was covered by next card beneath if cards are displayed close together (library search).
This commit is contained in:
parent
b2fe13c8c8
commit
d245ce1ad2
4 changed files with 23 additions and 1 deletions
|
@ -534,4 +534,11 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
@Override
|
||||
public void setChoosable(boolean isChoosable) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextOffset(int yOffset) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ public class CardArea extends JPanel {
|
|||
private boolean reloaded = false;
|
||||
private final javax.swing.JLayeredPane cardArea;
|
||||
private final javax.swing.JScrollPane scrollPane;
|
||||
private int yTextOffset;
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
|
@ -62,6 +63,7 @@ public class CardArea extends JPanel {
|
|||
|
||||
cardArea = new JLayeredPane();
|
||||
scrollPane.setViewportView(cardArea);
|
||||
yTextOffset = 10;
|
||||
|
||||
}
|
||||
|
||||
|
@ -82,9 +84,11 @@ public class CardArea extends JPanel {
|
|||
this.reloaded = true;
|
||||
cardArea.removeAll();
|
||||
if (showCards != null && showCards.size() < 10) {
|
||||
yTextOffset = 10;
|
||||
loadCardsFew(showCards, bigCard, gameId, listener);
|
||||
}
|
||||
else {
|
||||
yTextOffset = 0;
|
||||
loadCardsMany(showCards, bigCard, gameId, listener, dimension);
|
||||
}
|
||||
cardArea.revalidate();
|
||||
|
@ -96,6 +100,7 @@ public class CardArea extends JPanel {
|
|||
public void loadCardsNarrow(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, MouseListener listener) {
|
||||
this.reloaded = true;
|
||||
cardArea.removeAll();
|
||||
yTextOffset = 0;
|
||||
loadCardsMany(showCards, bigCard, gameId, listener, dimension);
|
||||
cardArea.revalidate();
|
||||
|
||||
|
@ -132,6 +137,7 @@ public class CardArea extends JPanel {
|
|||
cardArea.moveToFront(cardImg);
|
||||
cardImg.update(card);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimensions.frameWidth, cardDimensions.frameHeight);
|
||||
cardImg.setTextOffset(yTextOffset);
|
||||
cardImg.showCardTitle();
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
private JPanel cardArea;
|
||||
|
||||
private int yTextOffset = 10;
|
||||
|
||||
public CardPanel(CardView newGameCard, UUID gameId, final boolean loadImage, ActionCallback callback, final boolean foil, Dimension dimension) {
|
||||
this.gameCard = newGameCard;
|
||||
this.callback = callback;
|
||||
|
@ -583,7 +585,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
ptText.setVisible(showText);
|
||||
|
||||
int titleX = Math.round(cardWidth * (20f / 480));
|
||||
int titleY = Math.round(cardHeight * (9f / 680)) + 10; // TODO: Set to 0 if it's a card selection with small card offset (ike library search)
|
||||
int titleY = Math.round(cardHeight * (9f / 680)) + yTextOffset;
|
||||
titleText.setBounds(cardXOffset + titleX, cardYOffset + titleY, cardWidth - titleX, cardHeight - titleY);
|
||||
|
||||
Dimension ptSize = ptText.getPreferredSize();
|
||||
|
@ -1203,5 +1205,10 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
public void componentHidden(ComponentEvent ce) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextOffset(int yOffset) {
|
||||
yTextOffset = yOffset;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public abstract class MageCard extends JPanel {
|
|||
public abstract void setAlpha(float transparency);
|
||||
public abstract float getAlpha();
|
||||
public abstract CardView getOriginal();
|
||||
// sets the vertical text offset for the card name on the image
|
||||
public abstract void setTextOffset(int yOffset);
|
||||
public abstract void setCardBounds(int x, int y, int width, int height);
|
||||
public abstract void update(CardView card);
|
||||
public abstract void updateImage();
|
||||
|
|
Loading…
Reference in a new issue