3 import { browser } from '$app/env';
10 document.documentElement.style.setProperty('--dot-size', dotSize + 'px');
16 document.documentElement.style.setProperty('--dot-x', dotSize - x % dotSize + 'px');
17 document.documentElement.style.setProperty('--dot-y', dotSize - y % dotSize + 'px');
23 const moveCanvas = function moveCanvas(event) {
26 x -= event.x - dragging.x;
27 y -= event.y - dragging.y;
33 const startDragging = function startDragging(event) {
40 const stopDragging = function startDragging() {
44 const formatCoordinate = function formatCoordinate(coordinate) {
45 const sign = Math.sign(coordinate) === 1 ? '' : '-';
46 const value = Math.abs(coordinate).toString(16).padStart(4, 0);
52 <div class="canvas" on:mousedown={startDragging} on:mouseup={stopDragging} on:mousemove={moveCanvas}>
56 ({ formatCoordinate(x) }, { formatCoordinate(y) })
62 background: radial-gradient(#aaa, #aaa 1px, #fff 1px, #fff var(--dot-size));
63 background-size: var(--dot-size) var(--dot-size);
64 background-position: var(--dot-x) var(--dot-y);
72 background-color: #fff;
78 -webkit-font-smoothing : none;