From dabc4ff638feb7066b24b1f45cb417d98d9bfc94 Mon Sep 17 00:00:00 2001 From: drdev Date: Sun, 9 Mar 2014 04:41:31 +0000 Subject: [PATCH] Fix size discrepancy when showing 5 rows --- .../src/forge/screens/match/MatchScreen.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/forge-m-base/src/forge/screens/match/MatchScreen.java b/forge-m-base/src/forge/screens/match/MatchScreen.java index c1d5ee99cd3..4b5185a41ce 100644 --- a/forge-m-base/src/forge/screens/match/MatchScreen.java +++ b/forge-m-base/src/forge/screens/match/MatchScreen.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import forge.screens.FScreen; +import forge.screens.match.views.VAvatar; import forge.screens.match.views.VPlayerPanel; import forge.screens.match.views.VPrompt; import forge.screens.match.views.VStack; @@ -68,20 +69,29 @@ public class MatchScreen extends FScreen { @Override protected void doLayout(float startY, float width, float height) { - float topPlayerPanelHeight = (height - startY - VPrompt.HEIGHT) / 2f; - float bottomPlayerPanelHeight = topPlayerPanelHeight; - if (topPlayerPanel.getSelectedZone() == null) { //adjust heights based on visibility of zone displays + //determine player panel heights based on visibility of zone displays + float topPlayerPanelHeight, bottomPlayerPanelHeight; + float cardRowsHeight = height - startY - VPrompt.HEIGHT - 2 * VAvatar.HEIGHT; + if (topPlayerPanel.getSelectedZone() == null) { if (bottomPlayerPanel.getSelectedZone() != null) { - float offset = topPlayerPanelHeight / 6; - topPlayerPanelHeight -= offset; - bottomPlayerPanelHeight += offset; + topPlayerPanelHeight = cardRowsHeight * 2f / 5f; + bottomPlayerPanelHeight = cardRowsHeight * 3f / 5f; + } + else { + topPlayerPanelHeight = cardRowsHeight / 2f; + bottomPlayerPanelHeight = topPlayerPanelHeight; } } else if (bottomPlayerPanel.getSelectedZone() == null) { - float offset = bottomPlayerPanelHeight / 6; - bottomPlayerPanelHeight -= offset; - topPlayerPanelHeight += offset; + topPlayerPanelHeight = cardRowsHeight * 3f / 5f; + bottomPlayerPanelHeight = cardRowsHeight * 2f / 5f; } + else { + topPlayerPanelHeight = cardRowsHeight / 2f; + bottomPlayerPanelHeight = topPlayerPanelHeight; + } + topPlayerPanelHeight += VAvatar.HEIGHT; + bottomPlayerPanelHeight += VAvatar.HEIGHT; //log.setBounds(0, startY, width - FScreen.HEADER_HEIGHT, VLog.HEIGHT); topPlayerPanel.setBounds(0, startY, width, topPlayerPanelHeight);