mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Should have fixed blinking issue and synchronization stuff for mouse over card displaying.
This commit is contained in:
parent
e893935ce6
commit
7ac7fe1087
2 changed files with 17 additions and 13 deletions
|
|
@ -26,23 +26,25 @@ public class MageMouseMotionAdapter extends MouseMotionAdapter {
|
|||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) return;
|
||||
if (bigCard == null) return;
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {return;}
|
||||
if (bigCard == null) {return;}
|
||||
Object o = parent.getComponentAt(e.getPoint());
|
||||
if (o instanceof MagePermanent) {
|
||||
MagePermanent card = (MagePermanent) o;
|
||||
if (card.getOriginal().getId() != bigCard.getCardId()) {
|
||||
Image image = card.getImage();
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
image = ImageHelper.getResizedImage((BufferedImage) image, bigCard.getWidth(), bigCard.getHeight());
|
||||
bigCard.setCard(card.getOriginal().getId(), image, card.getOriginal().getRules());
|
||||
bigCard.hideTextComponent();
|
||||
} else {
|
||||
synchronized (MageMouseAdapter.class) {
|
||||
if (card.getOriginal().getId() != bigCard.getCardId()) {
|
||||
JXPanel panel = GuiDisplayUtil.getDescription(card.getOriginal(), bigCard.getWidth(), bigCard.getHeight());
|
||||
panel.setVisible(true);
|
||||
bigCard.hideTextComponent();
|
||||
bigCard.addJXPanel(card.getOriginal().getId(), panel);
|
||||
Image image = card.getImage();
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
image = ImageHelper.getResizedImage((BufferedImage) image, bigCard.getWidth(), bigCard.getHeight());
|
||||
bigCard.setCard(card.getOriginal().getId(), image, card.getOriginal().getRules());
|
||||
bigCard.hideTextComponent();
|
||||
} else {
|
||||
JXPanel panel = GuiDisplayUtil.getDescription(card.getOriginal(), bigCard.getWidth(), bigCard.getHeight());
|
||||
panel.setVisible(true);
|
||||
bigCard.hideTextComponent();
|
||||
bigCard.addJXPanel(card.getOriginal().getId(), panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,12 @@ public class GuiDisplayUtil {
|
|||
|
||||
public static JXPanel getDescription(CardView card, int width, int height) {
|
||||
JXPanel descriptionPanel = new JXPanel();
|
||||
descriptionPanel.setAlpha(.8f);
|
||||
|
||||
//descriptionPanel.setAlpha(.8f);
|
||||
descriptionPanel.setBounds(0, 0, width, height);
|
||||
descriptionPanel.setVisible(false);
|
||||
descriptionPanel.setLayout(null);
|
||||
|
||||
//descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green));
|
||||
|
||||
JButton j = new JButton("");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue