Skip to content

Commit

Permalink
fix gui positioning with navbar (fixes for mobile)
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Sep 18, 2023
1 parent 9428290 commit b19cab6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/menus/components/health_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HealthBar extends LitElement {
static get styles () {
return css`
.health {
position: absolute;
position: fixed;
display: flex;
flex-direction: row;
left: calc(50% - 91px);
Expand Down
2 changes: 1 addition & 1 deletion src/menus/components/hotbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Hotbar extends LitElement {
static get styles () {
return css`
.hotbar {
position: absolute;
position: fixed;
bottom: ${unsafeCSS(isProbablyIphone() ? '40px' : '0')};
left: 50%;
transform: translate(-50%);
Expand Down
20 changes: 10 additions & 10 deletions src/menus/hud.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class Hud extends LitElement {
static get styles () {
return css`
:host {
position: absolute;
position: fixed;
top: 0;
left: 0;
z-index: -2;
width: 100%;
height: 100%;
height: 100vh;
touch-action: none;
}
Expand All @@ -31,15 +31,15 @@ class Hud extends LitElement {
height: 16px;
background: url('${unsafeCSS(guiIcons1_17_1)}');
background-size: 256px;
position: absolute;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
}
#xp-label {
position: absolute;
position: fixed;
top: -8px;
left: 50%;
transform: translate(-50%);
Expand All @@ -51,7 +51,7 @@ class Hud extends LitElement {
}
#xp-bar-bg {
position: absolute;
position: fixed;
left: 50%;
bottom: 24px;
transform: translate(-50%);
Expand All @@ -73,7 +73,7 @@ class Hud extends LitElement {
.mobile-top-btns {
display: none;
flex-direction: row;
position: absolute;
position: fixed;
top: 0;
left: 50%;
transform: translate(-50%);
Expand Down Expand Up @@ -319,17 +319,17 @@ class Hud extends LitElement {
render () {
return html`
<div class="mobile-top-btns" id="mobile-top">
<button class="debug-btn" @click=${(e) => {
<button class="debug-btn" @pointerdown=${(e) => {
window.dispatchEvent(new MouseEvent('mousedown', { button: 1, }))
}}>Select</button>
<button class="debug-btn" @click=${(e) => {
<button class="debug-btn" @pointerdown=${(e) => {
this.shadowRoot.getElementById('debug-overlay').showOverlay = !this.shadowRoot.getElementById('debug-overlay').showOverlay
}}>F3</button>
<button class="chat-btn" @click=${(e) => {
<button class="chat-btn" @pointerdown=${(e) => {
e.stopPropagation()
this.shadowRoot.querySelector('#chat').enableChat()
}}></button>
<button class="pause-btn" @click=${(e) => {
<button class="pause-btn" @pointerdown=${(e) => {
e.stopPropagation()
showModal(document.getElementById('pause-screen'))
}}></button>
Expand Down
2 changes: 1 addition & 1 deletion src/menus/play_screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PlayScreen extends LitElement {
}
.edit-boxes {
position: absolute;
position: fixed;
top: 59px;
left: 50%;
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ body {
}

canvas {
position: absolute;
position: fixed;
top: 0;
left: 0;
height: 100%;
Expand All @@ -75,7 +75,7 @@ canvas {
}

#ui-root {
position: absolute;
position: fixed;
top: 0;
left: 0;
transform-origin: top left;
Expand Down

0 comments on commit b19cab6

Please sign in to comment.