blob: 2a5e89c36e118b5929e93abb84156fb4a1db0b70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { browser } from '$app/environment';
import { derived, writable } from 'svelte/store';
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}
});
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}
});
|