X-Git-Url: https://git.r.bdr.sh/rbdr/canvas/blobdiff_plain/d7cea96940ddeb764c7343e05526f611863019d8..HEAD:/src/lib/stores/canvas.js diff --git a/src/lib/stores/canvas.js b/src/lib/stores/canvas.js index e0cc115..ed0a5d7 100644 --- a/src/lib/stores/canvas.js +++ b/src/lib/stores/canvas.js @@ -1,24 +1,24 @@ -import { browser } from '$app/env'; +import { browser } from '$app/environment'; import { derived, writable } from 'svelte/store'; -export const canvas = writable({x: 0, y: 0}); +export const canvas = writable({ x: 0, y: 0 }); export const topLeft = derived(canvas, ($canvas) => { - if (browser) { - return { - x: $canvas.x - window.screen.width/2, - y: $canvas.y - window.screen.height/2 - }; - } - return {x: 0, y: 0} + if (browser) { + return { + x: $canvas.x - window.screen.width / 2, + y: $canvas.y - window.screen.height / 2 + }; + } + return { x: 0, y: 0 }; }); export const bottomRight = derived(canvas, ($canvas) => { - if (browser) { - return { - x: $canvas.x + window.screen.width/2, - y: $canvas.y + window.screen.height/2 - }; - } - return {x: 0, y: 0} + if (browser) { + return { + x: $canvas.x + window.screen.width / 2, + y: $canvas.y + window.screen.height / 2 + }; + } + return { x: 0, y: 0 }; });