diff --git a/src/components/Canvas.svelte b/src/components/Canvas.svelte index cf11efe..09d11e3 100644 --- a/src/components/Canvas.svelte +++ b/src/components/Canvas.svelte @@ -1,6 +1,9 @@ @@ -29,7 +32,22 @@ gl.putImageData(field, 0, 0) } + /** + * Calculate new borders and draw + * @param {PointerEvent} e + */ + function scaleDraw(e) { + const st = get(settings) + let coords = scaleCoordinates(st, width, height, e.clientX, e.clientY) + + settings.set('lx', coords.lx) + settings.set('rx', coords.rx) + settings.set('yc', coords.yc) + + draw() + } + onMount(init) - + diff --git a/src/components/Settings.svelte b/src/components/Settings.svelte index 7425d7a..6eca38f 100644 --- a/src/components/Settings.svelte +++ b/src/components/Settings.svelte @@ -15,6 +15,12 @@ function should_refresh() { refresh.set(true) } + function reset() { + settings.set('lx', -3) + settings.set('rx', 1) + settings.set('yc', 0) + should_refresh() + }