From b6e0544c95ff5438b2e44508fd14eabeabcff7c2 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Mon, 14 Jul 2014 13:29:32 +0400 Subject: [PATCH] [UI] Fixed stack cards offset --- Mage.Client/src/main/java/mage/client/cards/Cards.java | 8 +++++++- Mage.Client/src/main/java/mage/client/game/GamePanel.java | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Mage.Client/src/main/java/mage/client/cards/Cards.java b/Mage.Client/src/main/java/mage/client/cards/Cards.java index 831a53e0c1..9d4c70758b 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Cards.java +++ b/Mage.Client/src/main/java/mage/client/cards/Cards.java @@ -63,6 +63,8 @@ public class Cards extends javax.swing.JPanel { private static final Border emptyBorder = new EmptyBorder(0,0,0,0); + private int minOffsetY = 0; + /** * Defines whether component should be visible whenever there is no objects within. * True by default. @@ -316,7 +318,7 @@ public class Cards extends javax.swing.JPanel { int dx = 0; for (Component component : cards) { - component.setLocation(dx, component.getLocation().y); + component.setLocation(dx, Math.max(component.getLocation().y, minOffsetY)); dx += ((CardPanel) component).getCardWidth() + GAP_X; } } @@ -324,4 +326,8 @@ public class Cards extends javax.swing.JPanel { public void setZone(String zone) { this.zone = zone; } + + public void setMinOffsetY(int minOffsetY) { + this.minOffsetY = minOffsetY; + } } diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index e4e31cdd70..8eaa0d1e00 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -74,6 +74,7 @@ public final class GamePanel extends javax.swing.JPanel { private static final Logger logger = Logger.getLogger(GamePanel.class); private static final String YOUR_HAND = "Your hand"; private static final int X_PHASE_WIDTH = 55; + public static final int STACK_MIN_CARDS_OFFSET_Y = 7; private final Map players = new HashMap<>(); private final Map exiles = new HashMap<>(); private final Map revealed = new HashMap<>(); @@ -107,6 +108,8 @@ public final class GamePanel extends javax.swing.JPanel { this.feedbackPanel.setConnectedChatPanel(this.userChatPanel); + this.stack.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y); + // Override layout (I can't edit generated code) this.setLayout(new BorderLayout()); final JLayeredPane jLayeredBackgroundPane = new JLayeredPane();