aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores/RootStore.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-26 00:27:39 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-26 00:36:24 +0100
commitede3747a1d5ef1dd9a6d74ba9600ca4f9bc452ed (patch)
treecd5b779f76d3c4e6a77865bbe13e0dc85deb0af1 /packages/main/src/stores/RootStore.ts
parentfeat: Disable main window devtools in production (diff)
downloadsophie-ede3747a1d5ef1dd9a6d74ba9600ca4f9bc452ed.tar.gz
sophie-ede3747a1d5ef1dd9a6d74ba9600ca4f9bc452ed.tar.zst
sophie-ede3747a1d5ef1dd9a6d74ba9600ca4f9bc452ed.zip
refactor: Simplify browserViewBounds handling
Diffstat (limited to 'packages/main/src/stores/RootStore.ts')
-rw-r--r--packages/main/src/stores/RootStore.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/main/src/stores/RootStore.ts b/packages/main/src/stores/RootStore.ts
index 9d138ce..c09cd4a 100644
--- a/packages/main/src/stores/RootStore.ts
+++ b/packages/main/src/stores/RootStore.ts
@@ -27,10 +27,16 @@ import {
27} from '@sophie/shared'; 27} from '@sophie/shared';
28 28
29export const rootStore = types.model('RootStore', { 29export const rootStore = types.model('RootStore', {
30 browserViewBounds: types.model("BrowserViewBoundsStore", {
31 x: 0,
32 y: 0,
33 width: 0,
34 height: 0,
35 }),
30 shared: sharedStore, 36 shared: sharedStore,
31}).actions((self) => ({ 37}).actions((self) => ({
32 setBrowserViewBounds(bounds: BrowserViewBounds) { 38 setBrowserViewBounds(bounds: BrowserViewBounds) {
33 applySnapshot(self.shared.browserViewBounds, bounds); 39 applySnapshot(self.browserViewBounds, bounds);
34 }, 40 },
35 setPaletteMode(mode: PaletteMode) { 41 setPaletteMode(mode: PaletteMode) {
36 self.shared.shouldUseDarkColors = mode === 'dark'; 42 self.shared.shouldUseDarkColors = mode === 'dark';
@@ -41,6 +47,7 @@ export interface RootStore extends Instance<typeof rootStore> {}
41 47
42export function createRootStore(): RootStore { 48export function createRootStore(): RootStore {
43 return rootStore.create({ 49 return rootStore.create({
50 browserViewBounds: {},
44 shared: emptySharedStore, 51 shared: emptySharedStore,
45 }); 52 });
46} 53}