X-Git-Url: https://git.r.bdr.sh/rbdr/canvas/blobdiff_plain/e4e4b5202bf0039127f591941fddc1ff5ca09897..HEAD:/src/lib/stores/canvas.js?ds=inline diff --git a/src/lib/stores/canvas.js b/src/lib/stores/canvas.js index 2a5e89c..ed0a5d7 100644 --- a/src/lib/stores/canvas.js +++ b/src/lib/stores/canvas.js @@ -1,24 +1,24 @@ 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 }; });