diff --git a/src/app.css b/src/app.css index 9c3c590..8e3dbe3 100644 --- a/src/app.css +++ b/src/app.css @@ -1,11 +1,12 @@ -html, body { - width: 100vw; - height: 100vh; - padding: 0; - margin: 0; +html, +body { + width: 100vw; + height: 100vh; + padding: 0; + margin: 0; } canvas { - width: 100%; - height: 100%; -} \ No newline at end of file + width: 100%; + height: 100%; +} diff --git a/src/app.html b/src/app.html index 03d9b22..2f2d675 100644 --- a/src/app.html +++ b/src/app.html @@ -5,7 +5,7 @@ Grid - + %sveltekit.head% diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index dc3bd4e..f87b35e 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,5 +1,5 @@ - \ No newline at end of file + diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 50916db..d1049c0 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,83 +1,80 @@ { - mouseDown = true; - }} - on:mousemove={({ movementX, movementY }) => { - if (mouseDown) { - dragging = true; - x += movementX; - y += movementY; - } - }} - on:mouseup={({ offsetX, offsetY }) => { - mouseDown = false; - if (!dragging) { - const [xCoord, yCoord] = screenToMap(offsetX, offsetY); - map[JSON.stringify([xCoord, yCoord])] = !map[JSON.stringify([xCoord, yCoord])]; - } - dragging = false; - }} + bind:innerWidth={width} + bind:innerHeight={height} + on:mousedown={() => { + mouseDown = true; + }} + on:mousemove={({ movementX, movementY }) => { + if (mouseDown) { + dragging = true; + x += movementX; + y += movementY; + } + }} + on:mouseup={({ offsetX, offsetY }) => { + mouseDown = false; + if (!dragging) { + const [xCoord, yCoord] = screenToMap(offsetX, offsetY); + map[JSON.stringify([xCoord, yCoord])] = !map[JSON.stringify([xCoord, yCoord])]; + } + dragging = false; + }} /> - + \ No newline at end of file + :global(canvas) { + width: 100%; + height: 100%; + } +