Skip to content

Commit

Permalink
feat: zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDog896 committed Jul 14, 2023
1 parent 71a6878 commit e0674be
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
}
// draw the coords
context.fillStyle = map[JSON.stringify([xCoord, yCoord])] ? 'white' : 'black';
context.fillText(`${xCoord}, ${yCoord}`, xPos + 5, yPos + 15);
console.log(boxSize)
if (boxSize > 35) {
context.fillStyle = map[JSON.stringify([xCoord, yCoord])] ? 'white' : 'black';
context.font = `${boxSize / 2}px`;
context.fillText(`${xCoord}, ${yCoord}`, xPos + 5, yPos + 15);
}
}
}
};
Expand All @@ -48,6 +52,10 @@
<svelte:window
bind:innerWidth={width}
bind:innerHeight={height}
on:wheel={({ deltaY }) => {
boxSize += deltaY / 100;
boxSize = Math.min(Math.max(30, boxSize), 100);
}}
on:mousedown={() => {
mouseDown = true;
}}
Expand Down

0 comments on commit e0674be

Please sign in to comment.