Fix size discrepancy when showing 5 rows

This commit is contained in:
drdev
2014-03-09 04:41:31 +00:00
parent 77bdc7a950
commit dabc4ff638

View File

@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import forge.screens.FScreen; import forge.screens.FScreen;
import forge.screens.match.views.VAvatar;
import forge.screens.match.views.VPlayerPanel; import forge.screens.match.views.VPlayerPanel;
import forge.screens.match.views.VPrompt; import forge.screens.match.views.VPrompt;
import forge.screens.match.views.VStack; import forge.screens.match.views.VStack;
@@ -68,20 +69,29 @@ public class MatchScreen extends FScreen {
@Override @Override
protected void doLayout(float startY, float width, float height) { protected void doLayout(float startY, float width, float height) {
float topPlayerPanelHeight = (height - startY - VPrompt.HEIGHT) / 2f; //determine player panel heights based on visibility of zone displays
float bottomPlayerPanelHeight = topPlayerPanelHeight; float topPlayerPanelHeight, bottomPlayerPanelHeight;
if (topPlayerPanel.getSelectedZone() == null) { //adjust heights based on visibility of zone displays float cardRowsHeight = height - startY - VPrompt.HEIGHT - 2 * VAvatar.HEIGHT;
if (topPlayerPanel.getSelectedZone() == null) {
if (bottomPlayerPanel.getSelectedZone() != null) { if (bottomPlayerPanel.getSelectedZone() != null) {
float offset = topPlayerPanelHeight / 6; topPlayerPanelHeight = cardRowsHeight * 2f / 5f;
topPlayerPanelHeight -= offset; bottomPlayerPanelHeight = cardRowsHeight * 3f / 5f;
bottomPlayerPanelHeight += offset; }
else {
topPlayerPanelHeight = cardRowsHeight / 2f;
bottomPlayerPanelHeight = topPlayerPanelHeight;
} }
} }
else if (bottomPlayerPanel.getSelectedZone() == null) { else if (bottomPlayerPanel.getSelectedZone() == null) {
float offset = bottomPlayerPanelHeight / 6; topPlayerPanelHeight = cardRowsHeight * 3f / 5f;
bottomPlayerPanelHeight -= offset; bottomPlayerPanelHeight = cardRowsHeight * 2f / 5f;
topPlayerPanelHeight += offset;
} }
else {
topPlayerPanelHeight = cardRowsHeight / 2f;
bottomPlayerPanelHeight = topPlayerPanelHeight;
}
topPlayerPanelHeight += VAvatar.HEIGHT;
bottomPlayerPanelHeight += VAvatar.HEIGHT;
//log.setBounds(0, startY, width - FScreen.HEADER_HEIGHT, VLog.HEIGHT); //log.setBounds(0, startY, width - FScreen.HEADER_HEIGHT, VLog.HEIGHT);
topPlayerPanel.setBounds(0, startY, width, topPlayerPanelHeight); topPlayerPanel.setBounds(0, startY, width, topPlayerPanelHeight);