dylanebert
commited on
Commit
·
d898c0f
1
Parent(s):
6b6e352
prevent scroll; add skip button
Browse files- src/routes/Viewer.svelte +2 -2
- src/routes/Vote.svelte +7 -4
- static/global.css +6 -1
src/routes/Viewer.svelte
CHANGED
|
@@ -35,8 +35,8 @@
|
|
| 35 |
function handleResize() {
|
| 36 |
if (!canvas || !container) return;
|
| 37 |
requestAnimationFrame(() => {
|
| 38 |
-
const maxWidth = container.clientHeight *
|
| 39 |
-
const maxHeight = container.clientWidth *
|
| 40 |
canvas.width = Math.min(container.clientWidth, maxWidth);
|
| 41 |
canvas.height = Math.min(container.clientHeight, maxHeight);
|
| 42 |
});
|
|
|
|
| 35 |
function handleResize() {
|
| 36 |
if (!canvas || !container) return;
|
| 37 |
requestAnimationFrame(() => {
|
| 38 |
+
const maxWidth = container.clientHeight * 16 / 9;
|
| 39 |
+
const maxHeight = container.clientWidth * 9 / 16;
|
| 40 |
canvas.width = Math.min(container.clientWidth, maxWidth);
|
| 41 |
canvas.height = Math.min(container.clientHeight, maxHeight);
|
| 42 |
});
|
src/routes/Vote.svelte
CHANGED
|
@@ -138,14 +138,14 @@
|
|
| 138 |
function handleResize() {
|
| 139 |
requestAnimationFrame(() => {
|
| 140 |
if (canvasA && containerA) {
|
| 141 |
-
const maxWidth = containerA.clientHeight;
|
| 142 |
-
const maxHeight = containerA.clientWidth;
|
| 143 |
canvasA.width = Math.min(containerA.clientWidth, maxWidth);
|
| 144 |
canvasA.height = Math.min(containerA.clientHeight, maxHeight);
|
| 145 |
}
|
| 146 |
if (canvasB && containerB) {
|
| 147 |
-
const maxWidth = containerB.clientHeight;
|
| 148 |
-
const maxHeight = containerB.clientWidth;
|
| 149 |
canvasB.width = Math.min(containerB.clientWidth, maxWidth);
|
| 150 |
canvasB.height = Math.min(containerB.clientHeight, maxHeight);
|
| 151 |
}
|
|
@@ -189,4 +189,7 @@
|
|
| 189 |
<button class="vote-button" on:click={() => vote("B")}>B is Better</button>
|
| 190 |
</div>
|
| 191 |
</div>
|
|
|
|
|
|
|
|
|
|
| 192 |
{/if}
|
|
|
|
| 138 |
function handleResize() {
|
| 139 |
requestAnimationFrame(() => {
|
| 140 |
if (canvasA && containerA) {
|
| 141 |
+
const maxWidth = (containerA.clientHeight * 16) / 9;
|
| 142 |
+
const maxHeight = (containerA.clientWidth * 9) / 16;
|
| 143 |
canvasA.width = Math.min(containerA.clientWidth, maxWidth);
|
| 144 |
canvasA.height = Math.min(containerA.clientHeight, maxHeight);
|
| 145 |
}
|
| 146 |
if (canvasB && containerB) {
|
| 147 |
+
const maxWidth = (containerB.clientHeight * 16) / 9;
|
| 148 |
+
const maxHeight = (containerB.clientWidth * 9) / 16;
|
| 149 |
canvasB.width = Math.min(containerB.clientWidth, maxWidth);
|
| 150 |
canvasB.height = Math.min(containerB.clientHeight, maxHeight);
|
| 151 |
}
|
|
|
|
| 189 |
<button class="vote-button" on:click={() => vote("B")}>B is Better</button>
|
| 190 |
</div>
|
| 191 |
</div>
|
| 192 |
+
<div class="skip-container">
|
| 193 |
+
<button class="vote-button" on:click={() => loadScenes()}>Skip</button>
|
| 194 |
+
</div>
|
| 195 |
{/if}
|
static/global.css
CHANGED
|
@@ -351,7 +351,7 @@ body {
|
|
| 351 |
.voting-canvas {
|
| 352 |
width: 100%;
|
| 353 |
height: auto;
|
| 354 |
-
aspect-ratio:
|
| 355 |
}
|
| 356 |
|
| 357 |
.viewer-canvas {
|
|
@@ -377,6 +377,11 @@ body {
|
|
| 377 |
cursor: pointer;
|
| 378 |
}
|
| 379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
.tabs {
|
| 381 |
display: flex;
|
| 382 |
justify-content: left;
|
|
|
|
| 351 |
.voting-canvas {
|
| 352 |
width: 100%;
|
| 353 |
height: auto;
|
| 354 |
+
aspect-ratio: 16 / 9;
|
| 355 |
}
|
| 356 |
|
| 357 |
.viewer-canvas {
|
|
|
|
| 377 |
cursor: pointer;
|
| 378 |
}
|
| 379 |
|
| 380 |
+
.skip-container {
|
| 381 |
+
max-width: 50%;
|
| 382 |
+
margin: 0 auto;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
.tabs {
|
| 386 |
display: flex;
|
| 387 |
justify-content: left;
|