mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
[UI] Fixed stack cards offset
This commit is contained in:
parent
943ff0d78d
commit
b6e0544c95
2 changed files with 10 additions and 1 deletions
|
@ -63,6 +63,8 @@ public class Cards extends javax.swing.JPanel {
|
||||||
|
|
||||||
private static final Border emptyBorder = new EmptyBorder(0,0,0,0);
|
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.
|
* Defines whether component should be visible whenever there is no objects within.
|
||||||
* True by default.
|
* True by default.
|
||||||
|
@ -316,7 +318,7 @@ public class Cards extends javax.swing.JPanel {
|
||||||
|
|
||||||
int dx = 0;
|
int dx = 0;
|
||||||
for (Component component : cards) {
|
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;
|
dx += ((CardPanel) component).getCardWidth() + GAP_X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,4 +326,8 @@ public class Cards extends javax.swing.JPanel {
|
||||||
public void setZone(String zone) {
|
public void setZone(String zone) {
|
||||||
this.zone = zone;
|
this.zone = zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMinOffsetY(int minOffsetY) {
|
||||||
|
this.minOffsetY = minOffsetY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
private static final Logger logger = Logger.getLogger(GamePanel.class);
|
private static final Logger logger = Logger.getLogger(GamePanel.class);
|
||||||
private static final String YOUR_HAND = "Your hand";
|
private static final String YOUR_HAND = "Your hand";
|
||||||
private static final int X_PHASE_WIDTH = 55;
|
private static final int X_PHASE_WIDTH = 55;
|
||||||
|
public static final int STACK_MIN_CARDS_OFFSET_Y = 7;
|
||||||
private final Map<UUID, PlayAreaPanel> players = new HashMap<>();
|
private final Map<UUID, PlayAreaPanel> players = new HashMap<>();
|
||||||
private final Map<UUID, ExileZoneDialog> exiles = new HashMap<>();
|
private final Map<UUID, ExileZoneDialog> exiles = new HashMap<>();
|
||||||
private final Map<String, ShowCardsDialog> revealed = new HashMap<>();
|
private final Map<String, ShowCardsDialog> revealed = new HashMap<>();
|
||||||
|
@ -107,6 +108,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
this.feedbackPanel.setConnectedChatPanel(this.userChatPanel);
|
this.feedbackPanel.setConnectedChatPanel(this.userChatPanel);
|
||||||
|
|
||||||
|
this.stack.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y);
|
||||||
|
|
||||||
// Override layout (I can't edit generated code)
|
// Override layout (I can't edit generated code)
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
final JLayeredPane jLayeredBackgroundPane = new JLayeredPane();
|
final JLayeredPane jLayeredBackgroundPane = new JLayeredPane();
|
||||||
|
|
Loading…
Reference in a new issue