Improve landscape layout across device sizes

This commit is contained in:
Liam Westby 2018-03-29 11:29:01 -05:00
parent 55078e8b24
commit f5c73f1af2
2 changed files with 65 additions and 11 deletions

View File

@ -1,11 +1,14 @@
<div id="titlebar" class="navbar">
<div id="controls-container" [style.height.px]="windowHeight">
<div id="titlebar" class="navbar">
<h1>Liberty Bikes</h1>
</div>
<div id="game-buttons" class="navbar">
</div>
<div id="game-buttons" class="navbar">
<button type="button" (click)="startGame()">Start Game</button>
<button type="button" (click)="requeue()">Requeue</button>
</div>
<div id="controller" [style.height.px]="windowHeight">
</div>
<div id="controller">
<canvas id="dpad-canvas" width="800" height="800"></canvas>
</div>
</div>

View File

@ -13,6 +13,17 @@ body {
height: 100%;
}
#controls-container {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
display: flex;
align-items: center;
}
.navbar {
background-color: rgba(0, 0, 0, 0.2);
@ -29,6 +40,8 @@ body {
top: 0;
width: 100%;
background: none;
justify-content: center;
}
@ -57,6 +70,8 @@ body {
width: 100%;
padding: 0px 5px;
border-top: 1px solid white;
}
#game-buttons button {
@ -79,25 +94,61 @@ body {
margin: 0 auto;
}
@media screen and (max-height: 465px) {
#titlebar h1 {
font-size: 1em;
}
}
@media screen and (orientation: landscape) {
:host {
#controls-container {
display: grid;
grid-template-rows: 1fr 1fr;
grid-template-columns: 1fr 1fr;
grid-template-columns: auto 1fr;
justify-content: center;
align-items: center;
padding: 0 20px;
}
#titlebar {
position: relative;
grid-area: 1 / 2;
background: none;
height: 100%;
font-size: 1.5em;
}
#game-buttons {
position: relative;
grid-area: 2 / 2;
height: 100%;
justify-content: space-around;
align-items: flex-start;
border-top: none;
background: none;
}
#game-buttons button {
width: 150px;
height: 100px;
letter-spacing: unset;
}
#controller {
grid-area: 1 / 1 / span 2 / span 1;
grid-template: calc(100vmin - #{($titlebar) * 2}) / calc(100vmin - #{($titlebar) * 2});
}
@media screen and (max-height: 320px), screen and (max-width: 569px) {
#game-buttons button {
height: 50px;
}
}
}