]>
Commit | Line | Data |
---|---|---|
e4e4b520 | 1 | import { browser } from '$app/environment'; |
d7cea969 RBR |
2 | import { derived, writable } from 'svelte/store'; |
3 | ||
587d8fe6 | 4 | export const canvas = writable({ x: 0, y: 0 }); |
d7cea969 RBR |
5 | |
6 | export const topLeft = derived(canvas, ($canvas) => { | |
587d8fe6 RBR |
7 | if (browser) { |
8 | return { | |
9 | x: $canvas.x - window.screen.width / 2, | |
10 | y: $canvas.y - window.screen.height / 2 | |
11 | }; | |
12 | } | |
13 | return { x: 0, y: 0 }; | |
d7cea969 RBR |
14 | }); |
15 | ||
16 | export const bottomRight = derived(canvas, ($canvas) => { | |
587d8fe6 RBR |
17 | if (browser) { |
18 | return { | |
19 | x: $canvas.x + window.screen.width / 2, | |
20 | y: $canvas.y + window.screen.height / 2 | |
21 | }; | |
22 | } | |
23 | return { x: 0, y: 0 }; | |
d7cea969 | 24 | }); |