Skip to content

Commit 19c75f9

Browse files
committed
WASM: Mobile layout
1 parent 974f921 commit 19c75f9

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

web/main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ Promise.all([wasmReady, documentReady]).then(async () => {
114114

115115
for (let [id, mask] of Object.entries(elementKeyMap)) {
116116
let el = document.getElementById(id);
117-
el.style.touchAction = "none";
118117

119118
el.addEventListener("mousedown", (e) => {
120119
e.preventDefault();
@@ -137,6 +136,10 @@ Promise.all([wasmReady, documentReady]).then(async () => {
137136
});
138137
}
139138

139+
document.querySelectorAll(".controls *").forEach((el) => {
140+
el.style.touchAction = "manipulation";
141+
});
142+
140143
// ========================
141144
// ROM loading
142145
// ========================

web/style.css

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ body {
8787
https://codepen.io/injectilo/pen/MYJrmm */
8888

8989
.controls {
90+
touch-action: manipulation;
9091
padding: 25px 15px;
9192
background: #4e4e4e;
9293
display: flex;
@@ -147,6 +148,7 @@ body {
147148
transform: translateY(-50%);
148149
background: #252725;
149150
z-index: 1;
151+
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.4);
150152
}
151153

152154
.dpad__vertical {
@@ -157,6 +159,7 @@ body {
157159
border-radius: 4px;
158160
transform: translateX(-50%);
159161
background: #252725;
162+
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.4);
160163
z-index: 2;
161164
}
162165

@@ -201,19 +204,19 @@ body {
201204
}
202205

203206
.dpad__border.-vert {
204-
width: 38px;
205-
top: -2px;
206-
bottom: -2px;
207+
width: 40px;
208+
top: -3px;
209+
bottom: -3px;
207210
z-index: 0;
208211
left: 50%;
209212
transform: translateX(-50%);
210213
border-radius: 4px;
211214
}
212215

213216
.dpad__border.-horiz {
214-
height: 38px;
215-
right: -2px;
216-
left: -2px;
217+
height: 40px;
218+
right: -3px;
219+
left: -3px;
217220
z-index: 0;
218221
top: 50%;
219222
transform: translateY(-50%);
@@ -232,7 +235,7 @@ body {
232235
z-index: 3;
233236
border-radius: 50%;
234237
background: linear-gradient(180deg, rgb(22, 22, 22) 30%, rgb(58, 58, 58) 100%);
235-
box-shadow: inset 0 -2px 0 0 rgba(255, 255, 255, 0.1);
238+
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 -1px rgba(0, 0, 0, 0.4);
236239
}
237240

238241
.center-buttons {
@@ -256,7 +259,7 @@ body {
256259
user-select: none;
257260
background-color: #464646;
258261
border: 1px solid #272723;
259-
box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.51);
262+
box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.51), 0 1px 1px 0 rgba(0, 0, 0, 0.4)
260263
}
261264

262265
.center-buttons__label {
@@ -296,7 +299,7 @@ body {
296299
color: rgba(255, 255, 255, 0.6);
297300
border: 1px rgba(0, 0, 0, 0.51) solid;
298301
background: linear-gradient(to bottom, #df2015 0%, #f84936 100%);
299-
box-shadow: inset 0 1px 2px 0 #fbfbfb, 0 1px 1px 0 rgba(0, 0, 0, 0.71);
302+
box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 1px 1px 0 rgba(0, 0, 0, 0.4);
300303
}
301304

302305
.rom-select {

0 commit comments

Comments
 (0)