From 9a43c1b3ae7988ff63e8e0ec53aae613b8c263e7 Mon Sep 17 00:00:00 2001 From: Agetian Date: Tue, 10 Apr 2018 10:56:33 +0300 Subject: [PATCH] - Ensure that players have equal player panel heights in a two-player game in Landscape mode --- .../src/forge/screens/match/MatchScreen.java | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java index 249a06f441f..774d8c34355 100644 --- a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java +++ b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java @@ -544,27 +544,36 @@ public class MatchScreen extends FScreen { } float playerCount = getPlayerPanels().keySet().size(); - //determine player panel heights based on visibility of zone displays - float cardRowsHeight = totalHeight - playerCount * avatarHeight; - float totalCardRows = 0; - for (VPlayerPanel playerPanel : playerPanelsList){ - if (playerPanel.getSelectedTab() != null){ - totalCardRows += 1; + if (Forge.isLandscapeMode() && playerCount == 2) { + // Ensure that players have equal player panel heights in two player Forge in Landscape mode + float topPlayerPanelHeight = totalHeight / 2; + float bottomPlayerPanelHeight = topPlayerPanelHeight; + topPlayerPanel.setBounds(0, 0, visibleWidth, topPlayerPanelHeight); + bottomPlayerPanel.setBounds(0, totalHeight - bottomPlayerPanelHeight, visibleWidth, bottomPlayerPanelHeight); + } else { + // Determine player panel heights based on visibility of zone displays + float cardRowsHeight = totalHeight - playerCount * avatarHeight; + float totalCardRows = 0; + for (VPlayerPanel playerPanel : playerPanelsList) { + if (playerPanel.getSelectedTab() != null) { + totalCardRows += 1; + } + totalCardRows += 2; } - totalCardRows += 2; - } - float y = 0; - for (VPlayerPanel playerPanel : playerPanelsList){ - float panelHeight; - if (playerPanel.getSelectedTab() != null) { - panelHeight = cardRowsHeight * 3f / totalCardRows; - } else{ - panelHeight = cardRowsHeight * 2f / totalCardRows; + float y = 0; + for (VPlayerPanel playerPanel : playerPanelsList) { + float panelHeight; + if (playerPanel.getSelectedTab() != null) { + panelHeight = cardRowsHeight * 3f / totalCardRows; + } else { + panelHeight = cardRowsHeight * 2f / totalCardRows; + } + panelHeight += avatarHeight; + playerPanel.setBounds(0, y, visibleWidth, panelHeight); + y += panelHeight; } - panelHeight += avatarHeight; - playerPanel.setBounds(0, y, visibleWidth, panelHeight); - y += panelHeight; } + return new ScrollBounds(visibleWidth, totalHeight); }