@pretty-chitty/core 2.3.6 → 2.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/1ea77c9e193d437b9bfa.woff +0 -0
  2. package/dist/2282b9ff81c2cd7cf5b4.mp3 +0 -0
  3. package/dist/22a445dd65cce94defdd.woff2 +0 -0
  4. package/dist/2b94f846c05846d73536.mp3 +0 -0
  5. package/dist/32d6296b80e676d66bda.woff +0 -0
  6. package/dist/36e7e033bfef7b32bf3c.mp3 +0 -0
  7. package/dist/37f3b2ddcbe588b2aaa5.jpg +0 -0
  8. package/dist/3f0fb9058a03e14ad2fa.jpg +0 -0
  9. package/dist/412050b824afb24fef88.mp3 +0 -0
  10. package/dist/468cf705a21091e5f755.mp3 +0 -0
  11. package/dist/47a823ae095f5f4cfd82.woff +0 -0
  12. package/dist/5062c95fb3c68af2ee2e.woff2 +0 -0
  13. package/dist/5aecd40f51b84ffb6efa.woff2 +0 -0
  14. package/dist/5d184fc5808150d51726.mp3 +0 -0
  15. package/dist/60b937eec087d648c831.woff2 +0 -0
  16. package/dist/63da6d06ce0ff84b8b2c.mp3 +0 -0
  17. package/dist/63f3d4f28784375801ac.woff +0 -0
  18. package/dist/669804475e1d5e52a4f5.mp3 +0 -0
  19. package/dist/6a6d042ba2a9290aba9c.woff2 +0 -0
  20. package/dist/72e60d1c7f7c603f31d6.woff +0 -0
  21. package/dist/788c3dfe27f9734edff5.mp3 +0 -0
  22. package/dist/7e339dfbea59fe54f2e3.png +0 -0
  23. package/dist/7ecd698217d211cad841.mp3 +0 -0
  24. package/dist/8c8f3dcefaec6a40d787.mp3 +0 -0
  25. package/dist/8d29c92c7f9ca79d8a5c.mp3 +0 -0
  26. package/dist/8ea5f16c95238d2ff902.mp3 +0 -0
  27. package/dist/97e19a7d82ab67080019.mp3 +0 -0
  28. package/dist/98373f88bbc3b8237b09.mp3 +0 -0
  29. package/dist/98c71bee993adc81d5be.mp3 +0 -0
  30. package/dist/a09db3cc936e581f320a.mp3 +0 -0
  31. package/dist/a51c64560480e6fdae0d.mp3 +0 -0
  32. package/dist/ad2392bc6cdf9bb1b5fd.mp3 +0 -0
  33. package/dist/b3708bfbeff0d340bdef.mp3 +0 -0
  34. package/dist/b81893c113e684d9eec4.woff +0 -0
  35. package/dist/bc6bc3d7802469910f83.mp3 +0 -0
  36. package/dist/bde37bf538e175149c3b.mp3 +0 -0
  37. package/dist/d6b5a560b17d31cd3c7c.mp3 +0 -0
  38. package/dist/dd3231a4b15c4f8f2b94.mp3 +0 -0
  39. package/dist/f63358bf5b9e4f8d7f79.mp3 +0 -0
  40. package/dist/fc02be176de567378fa4.woff2 +0 -0
  41. package/dist/fe1535c25dc5d879c085.mp3 +0 -0
  42. package/dist/index.html +12 -0
  43. package/dist/main.034dfcc6b83fdd218994.hot-update.js +265 -0
  44. package/dist/main.034dfcc6b83fdd218994.hot-update.js.map +1 -0
  45. package/dist/main.034dfcc6b83fdd218994.hot-update.json +1 -0
  46. package/dist/main.0c0a98b3b3e1e004beb2.hot-update.js +265 -0
  47. package/dist/main.0c0a98b3b3e1e004beb2.hot-update.js.map +1 -0
  48. package/dist/main.0c0a98b3b3e1e004beb2.hot-update.json +1 -0
  49. package/dist/main.13daf8cac0f0a3231f6a.hot-update.js +190 -0
  50. package/dist/main.13daf8cac0f0a3231f6a.hot-update.js.map +1 -0
  51. package/dist/main.13daf8cac0f0a3231f6a.hot-update.json +1 -0
  52. package/dist/main.14e055541f09be93a122.hot-update.js +321 -0
  53. package/dist/main.14e055541f09be93a122.hot-update.js.map +1 -0
  54. package/dist/main.14e055541f09be93a122.hot-update.json +1 -0
  55. package/dist/main.26499c88c63113e7a3f8.hot-update.js +190 -0
  56. package/dist/main.26499c88c63113e7a3f8.hot-update.js.map +1 -0
  57. package/dist/main.26499c88c63113e7a3f8.hot-update.json +1 -0
  58. package/dist/main.2c3a3f1928ea25c4b79a.hot-update.js +11 -0
  59. package/dist/main.2c3a3f1928ea25c4b79a.hot-update.js.map +1 -0
  60. package/dist/main.2c3a3f1928ea25c4b79a.hot-update.json +1 -0
  61. package/dist/main.324b63996b3b36daf5af.hot-update.js +603 -0
  62. package/dist/main.324b63996b3b36daf5af.hot-update.js.map +1 -0
  63. package/dist/main.324b63996b3b36daf5af.hot-update.json +1 -0
  64. package/dist/main.4b0f7799388b5de9908d.hot-update.js +265 -0
  65. package/dist/main.4b0f7799388b5de9908d.hot-update.js.map +1 -0
  66. package/dist/main.4b0f7799388b5de9908d.hot-update.json +1 -0
  67. package/dist/main.6424291443afea7eb7ac.hot-update.js +187 -0
  68. package/dist/main.6424291443afea7eb7ac.hot-update.js.map +1 -0
  69. package/dist/main.6424291443afea7eb7ac.hot-update.json +1 -0
  70. package/dist/main.69127e32a0c76b421f15.hot-update.js +392 -0
  71. package/dist/main.69127e32a0c76b421f15.hot-update.js.map +1 -0
  72. package/dist/main.69127e32a0c76b421f15.hot-update.json +1 -0
  73. package/dist/main.755d91e1a6c7e6bd6702.hot-update.js +265 -0
  74. package/dist/main.755d91e1a6c7e6bd6702.hot-update.js.map +1 -0
  75. package/dist/main.755d91e1a6c7e6bd6702.hot-update.json +1 -0
  76. package/dist/main.75a666c9d30baa58c5ec.hot-update.js +265 -0
  77. package/dist/main.75a666c9d30baa58c5ec.hot-update.js.map +1 -0
  78. package/dist/main.75a666c9d30baa58c5ec.hot-update.json +1 -0
  79. package/dist/main.828f4c348446c6c3640d.hot-update.js +11 -0
  80. package/dist/main.828f4c348446c6c3640d.hot-update.js.map +1 -0
  81. package/dist/main.828f4c348446c6c3640d.hot-update.json +1 -0
  82. package/dist/main.8459249b2915a8823bd3.hot-update.js +321 -0
  83. package/dist/main.8459249b2915a8823bd3.hot-update.js.map +1 -0
  84. package/dist/main.8459249b2915a8823bd3.hot-update.json +1 -0
  85. package/dist/main.87f757c2602cac7001cb.hot-update.js +382 -0
  86. package/dist/main.87f757c2602cac7001cb.hot-update.js.map +1 -0
  87. package/dist/main.87f757c2602cac7001cb.hot-update.json +1 -0
  88. package/dist/main.8aa248086ab27072c348.hot-update.js +265 -0
  89. package/dist/main.8aa248086ab27072c348.hot-update.js.map +1 -0
  90. package/dist/main.8aa248086ab27072c348.hot-update.json +1 -0
  91. package/dist/main.8ce461bf769f3943b7ed.hot-update.js +265 -0
  92. package/dist/main.8ce461bf769f3943b7ed.hot-update.js.map +1 -0
  93. package/dist/main.8ce461bf769f3943b7ed.hot-update.json +1 -0
  94. package/dist/main.9fdbde5beb7c70940250.hot-update.js +392 -0
  95. package/dist/main.9fdbde5beb7c70940250.hot-update.js.map +1 -0
  96. package/dist/main.9fdbde5beb7c70940250.hot-update.json +1 -0
  97. package/dist/main.af59faaae348c919e033.hot-update.js +11 -0
  98. package/dist/main.af59faaae348c919e033.hot-update.js.map +1 -0
  99. package/dist/main.af59faaae348c919e033.hot-update.json +1 -0
  100. package/dist/main.b11900976593b0e609ee.hot-update.js +187 -0
  101. package/dist/main.b11900976593b0e609ee.hot-update.js.map +1 -0
  102. package/dist/main.b11900976593b0e609ee.hot-update.json +1 -0
  103. package/dist/main.b57518d376449c846971.hot-update.js +265 -0
  104. package/dist/main.b57518d376449c846971.hot-update.js.map +1 -0
  105. package/dist/main.b57518d376449c846971.hot-update.json +1 -0
  106. package/dist/main.b5fa8b91f66c4a67740b.hot-update.js +265 -0
  107. package/dist/main.b5fa8b91f66c4a67740b.hot-update.js.map +1 -0
  108. package/dist/main.b5fa8b91f66c4a67740b.hot-update.json +1 -0
  109. package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.js +265 -0
  110. package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.js.map +1 -0
  111. package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.json +1 -0
  112. package/dist/main.c9b051fce9f983306d51.hot-update.js +265 -0
  113. package/dist/main.c9b051fce9f983306d51.hot-update.js.map +1 -0
  114. package/dist/main.c9b051fce9f983306d51.hot-update.json +1 -0
  115. package/dist/main.d03d8e0bfcbd86932c58.hot-update.js +638 -0
  116. package/dist/main.d03d8e0bfcbd86932c58.hot-update.js.map +1 -0
  117. package/dist/main.d03d8e0bfcbd86932c58.hot-update.json +1 -0
  118. package/dist/main.d3b74a9a35325f35373d.hot-update.js +265 -0
  119. package/dist/main.d3b74a9a35325f35373d.hot-update.js.map +1 -0
  120. package/dist/main.d3b74a9a35325f35373d.hot-update.json +1 -0
  121. package/dist/main.d61b231278a9c69df2f8.hot-update.js +265 -0
  122. package/dist/main.d61b231278a9c69df2f8.hot-update.js.map +1 -0
  123. package/dist/main.d61b231278a9c69df2f8.hot-update.json +1 -0
  124. package/dist/pretty-chitty.js +243813 -0
  125. package/dist/pretty-chitty.js.map +1 -0
  126. package/package.json +1 -1
  127. package/src/library/components/ActionLogDisplay.tsx +1 -1
  128. package/src/library/components/ActionLogSidebar.tsx +1 -1
  129. package/src/library/components/BottomBar.tsx +2 -0
  130. package/src/library/components/BottomBarButton.tsx +3 -3
  131. package/src/library/components/MatchViewer.tsx +23 -9
  132. package/src/library/components/Panel/MultiPanel.tsx +7 -6
  133. package/src/library/components/Panel/PanelContents.tsx +4 -2
  134. package/src/library/components/Panel/SinglePanel.tsx +7 -6
  135. package/src/library/components/SettingsDisplay.tsx +152 -90
  136. package/src/library/components/TopBar.tsx +2 -0
  137. package/src/library/components/TopBarPlayers.tsx +4 -2
  138. package/src/library/game/DisplaySettings.test.ts +80 -0
  139. package/src/library/game/DisplaySettings.ts +153 -0
  140. package/src/library/game/GameTheme.ts +10 -0
  141. package/src/library/hooks/useDisplaySettings.tsx +58 -0
  142. package/src/library/hooks/usePanelScale.tsx +0 -23
@@ -0,0 +1,153 @@
1
+ import { GameTheme } from "./GameTheme";
2
+
3
+ /** The parts of the match screen a player can size on their own */
4
+ export type DisplaySection = "panelLayout" | "panelPadding" | "topBar" | "actionLog" | "bottomBar";
5
+
6
+ /** A step per section: 0 (smallest) to 4 (biggest), 2 being the game's own theme */
7
+ export type DisplaySettings = Record<DisplaySection, number>;
8
+
9
+ export const DISPLAY_STEP_COUNT = 5;
10
+ export const NORMAL_STEP = 2;
11
+ export const DISPLAY_STEP_LABELS = ["Smallest", "Smaller", "Normal", "Bigger", "Biggest"];
12
+
13
+ export const DISPLAY_SECTIONS: { key: DisplaySection; label: string; smallerHint: string; biggerHint: string }[] = [
14
+ { key: "panelLayout", label: "Panel Layout", smallerHint: "More panels", biggerHint: "Bigger panels" },
15
+ { key: "panelPadding", label: "Panel Padding", smallerHint: "Tighter", biggerHint: "Roomier" },
16
+ { key: "topBar", label: "Top Bar", smallerHint: "Smaller", biggerHint: "Bigger" },
17
+ { key: "actionLog", label: "Action Log", smallerHint: "Smaller", biggerHint: "Bigger" },
18
+ { key: "bottomBar", label: "Bottom Bar", smallerHint: "Smaller", biggerHint: "Bigger" },
19
+ ];
20
+
21
+ /**
22
+ * What each step multiplies the theme's sizes by. Panel layout is the odd one out: it is the scale
23
+ * the layout is worked out at, where a higher scale fits more (smaller) panels on screen, so it
24
+ * runs downwards as the panels get bigger.
25
+ */
26
+ const MULTIPLIERS: Record<DisplaySection, number[]> = {
27
+ panelLayout: [1.8, 1.35, 1, 0.8, 0.65],
28
+ panelPadding: [0.25, 0.5, 1, 1.75, 2.5],
29
+ topBar: [0.75, 0.875, 1, 1.2, 1.4],
30
+ actionLog: [0.8, 0.9, 1, 1.2, 1.4],
31
+ bottomBar: [0.7, 0.85, 1, 1.15, 1.3],
32
+ };
33
+
34
+ /**
35
+ * Animation playback speeds, slowest to fastest: one step below normal (the default) and three
36
+ * doublings above it, up to 8x.
37
+ */
38
+ export const ANIMATION_SPEEDS = [0.5, 1, 2, 4, 8];
39
+
40
+ export const DEFAULT_DISPLAY_SETTINGS: DisplaySettings = {
41
+ panelLayout: NORMAL_STEP,
42
+ panelPadding: NORMAL_STEP,
43
+ topBar: NORMAL_STEP,
44
+ actionLog: NORMAL_STEP,
45
+ bottomBar: NORMAL_STEP,
46
+ };
47
+
48
+ const STORAGE_KEY = "displaySettings";
49
+ /** The free-form panel scale that came before these settings */
50
+ const LEGACY_PANEL_SCALE_KEY = "panelScale";
51
+
52
+ function clampStep(step: unknown): number {
53
+ const n = typeof step === "number" && Number.isFinite(step) ? Math.round(step) : NORMAL_STEP;
54
+ return Math.max(0, Math.min(DISPLAY_STEP_COUNT - 1, n));
55
+ }
56
+
57
+ /** The index of the value in `values` nearest to `value`, measured as a ratio (they are all scales) */
58
+ function nearestIndex(values: number[], value: number): number {
59
+ let best = 0;
60
+ for (let i = 1; i < values.length; i++) {
61
+ if (Math.abs(Math.log(values[i] / value)) < Math.abs(Math.log(values[best] / value))) {
62
+ best = i;
63
+ }
64
+ }
65
+ return best;
66
+ }
67
+
68
+ export function sectionMultiplier(section: DisplaySection, settings: DisplaySettings): number {
69
+ return MULTIPLIERS[section][clampStep(settings[section])];
70
+ }
71
+
72
+ /** The animation speed step nearest to a duration multiplier (1 / speed), as `ClientTimeState` keeps it */
73
+ export function animationSpeedStep(durationMultiplier: number): number {
74
+ return nearestIndex(ANIMATION_SPEEDS, 1 / (durationMultiplier || 1));
75
+ }
76
+
77
+ /** The step every section shares, or undefined when they have been set individually */
78
+ export function overallStep(settings: DisplaySettings): number | undefined {
79
+ const steps = DISPLAY_SECTIONS.map((s) => settings[s.key]);
80
+ return steps.every((s) => s === steps[0]) ? steps[0] : undefined;
81
+ }
82
+
83
+ export function allAtStep(step: number): DisplaySettings {
84
+ const result = { ...DEFAULT_DISPLAY_SETTINGS };
85
+ for (const { key } of DISPLAY_SECTIONS) {
86
+ result[key] = clampStep(step);
87
+ }
88
+ return result;
89
+ }
90
+
91
+ export function loadDisplaySettings(storage: Pick<Storage, "getItem"> | undefined): DisplaySettings {
92
+ const result = { ...DEFAULT_DISPLAY_SETTINGS };
93
+ try {
94
+ const raw = storage?.getItem(STORAGE_KEY);
95
+ if (raw) {
96
+ const parsed = JSON.parse(raw);
97
+ for (const { key } of DISPLAY_SECTIONS) {
98
+ result[key] = clampStep(parsed?.[key]);
99
+ }
100
+ return result;
101
+ }
102
+ const legacyScale = parseFloat(storage?.getItem(LEGACY_PANEL_SCALE_KEY) ?? "");
103
+ if (legacyScale > 0) {
104
+ result.panelLayout = nearestIndex(MULTIPLIERS.panelLayout, legacyScale);
105
+ }
106
+ } catch {
107
+ // unreadable storage: everything stays at the game's own sizes
108
+ }
109
+ return result;
110
+ }
111
+
112
+ export function saveDisplaySettings(storage: Pick<Storage, "setItem"> | undefined, settings: DisplaySettings) {
113
+ try {
114
+ storage?.setItem(STORAGE_KEY, JSON.stringify(settings));
115
+ } catch {
116
+ // storage unavailable: the setting lasts until the page closes
117
+ }
118
+ }
119
+
120
+ /**
121
+ * A copy of `theme` with the sizes that belong to `section` multiplied by the player's setting for
122
+ * it. Returns `theme` itself when the section is at its normal size.
123
+ */
124
+ export function scaledTheme(theme: GameTheme, section: DisplaySection, settings: DisplaySettings): GameTheme {
125
+ const m = sectionMultiplier(section, settings);
126
+ if (m === 1 || section === "panelLayout") {
127
+ return theme;
128
+ }
129
+ // Copy the fields onto the same prototype, so getters (fontFamily) and methods still work and
130
+ // no setter runs
131
+ const result: GameTheme = Object.assign(Object.create(Object.getPrototypeOf(theme)), theme);
132
+ switch (section) {
133
+ case "panelPadding":
134
+ result.panelSpacing = theme.getPanelSpacing() * m;
135
+ break;
136
+ case "topBar":
137
+ result.topBarHeight = theme.topBarHeight * m;
138
+ result.fontScalar = theme.fontScalar * m;
139
+ result.spacing = theme.spacing * m;
140
+ break;
141
+ case "actionLog":
142
+ result.fontScalar = theme.fontScalar * m;
143
+ result.actionLogSidebarWidth = theme.actionLogSidebarWidth * m;
144
+ break;
145
+ case "bottomBar":
146
+ result.bottomBarHeight = theme.bottomBarHeight * m;
147
+ result.bottomBarFontScalar = theme.bottomBarFontScalar * m;
148
+ result.bottomBarIconSize = theme.bottomBarIconSize * m;
149
+ result.spacing = theme.spacing * m;
150
+ break;
151
+ }
152
+ return result;
153
+ }
@@ -32,7 +32,11 @@ export class GameTheme {
32
32
  public backgroundColor = "#0f0119";
33
33
 
34
34
  public spacing = 8;
35
+ /** The gap around each panel; defaults to `spacing` */
36
+ public panelSpacing?: number;
35
37
  public bottomBarHeight = 80;
38
+ /** The size of the icons on the bottom bar's buttons */
39
+ public bottomBarIconSize = 30;
36
40
  public topBarHeight = 40;
37
41
  public barColor = "#1c092c";
38
42
  public barGradientPercent = 0.05;
@@ -100,6 +104,8 @@ export class GameTheme {
100
104
  public actionLogTextColor = "#ffffff";
101
105
  public actionBarWidth = 600;
102
106
  public actionBarLinesToShow = 2;
107
+ /** The width of the action log shown beside the game on large screens */
108
+ public actionLogSidebarWidth = 350;
103
109
  public inlineGalleryBackgroundColor = "rgba(255,255,255,0.1)";
104
110
  public inlineGalleryButtonBackgroundColor = "#000000";
105
111
  public inlineGalleryButtonForegroundColor = "rgba(255,255,255,0.5)";
@@ -142,6 +148,10 @@ export class GameTheme {
142
148
  return result;
143
149
  }
144
150
 
151
+ getPanelSpacing(): number {
152
+ return this.panelSpacing ?? this.spacing;
153
+ }
154
+
145
155
  layoutSize(width: number): "large" | "medium" | "mobile" {
146
156
  return width >= this.actionBarWidth * 2 ? "large" : width >= this.actionBarWidth * 1.3 ? "medium" : "mobile";
147
157
  }
@@ -0,0 +1,58 @@
1
+ import React, { useContext, createContext, ReactNode, useState, useMemo, useCallback } from "react";
2
+ import {
3
+ DEFAULT_DISPLAY_SETTINGS,
4
+ DisplaySection,
5
+ DisplaySettings,
6
+ loadDisplaySettings,
7
+ saveDisplaySettings,
8
+ scaledTheme,
9
+ sectionMultiplier,
10
+ } from "../game/DisplaySettings";
11
+ import { GameThemeProvider, useGameTheme } from "./useGameTheme";
12
+
13
+ function browserStorage(): Storage | undefined {
14
+ try {
15
+ return typeof localStorage === "undefined" ? undefined : localStorage;
16
+ } catch {
17
+ return undefined;
18
+ }
19
+ }
20
+
21
+ const DisplaySettingsContext = createContext<{
22
+ settings: DisplaySettings;
23
+ setSettings: (settings: DisplaySettings) => void;
24
+ }>({
25
+ settings: DEFAULT_DISPLAY_SETTINGS,
26
+ setSettings: () => {},
27
+ });
28
+
29
+ export function useDisplaySettings(): [DisplaySettings, (settings: DisplaySettings) => void] {
30
+ const { settings, setSettings } = useContext(DisplaySettingsContext);
31
+ return [settings, setSettings];
32
+ }
33
+
34
+ /** The scale the panel layout is worked out at: above 1 fits more panels on screen, below 1 fewer */
35
+ export function usePanelScale(): number {
36
+ return sectionMultiplier("panelLayout", useContext(DisplaySettingsContext).settings);
37
+ }
38
+
39
+ export function DisplaySettingsProvider({ children }: { children: ReactNode }) {
40
+ // Not per game: a player's screen and eyesight are the same whatever they play
41
+ const [settings, setSettingsState] = useState<DisplaySettings>(() => loadDisplaySettings(browserStorage()));
42
+ const setSettings = useCallback((next: DisplaySettings) => {
43
+ saveDisplaySettings(browserStorage(), next);
44
+ setSettingsState(next);
45
+ }, []);
46
+ const value = useMemo(() => ({ settings, setSettings }), [settings, setSettings]);
47
+ return <DisplaySettingsContext.Provider value={value}>{children}</DisplaySettingsContext.Provider>;
48
+ }
49
+
50
+ /** Gives everything inside the game theme sized by the player's setting for `section` */
51
+ export function DisplaySectionTheme({ section, children }: { section: DisplaySection; children: ReactNode }) {
52
+ const theme = useGameTheme();
53
+ const { settings } = useContext(DisplaySettingsContext);
54
+ const sectionStep = settings[section];
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ const scaled = useMemo(() => scaledTheme(theme, section, settings), [theme, section, sectionStep]);
57
+ return <GameThemeProvider theme={scaled}>{children}</GameThemeProvider>;
58
+ }
@@ -1,23 +0,0 @@
1
- import React, { useContext, createContext, ReactNode, useState } from "react";
2
-
3
- const PanelScaleContext = createContext<{ scale: number; setScale: (n: number) => void }>({
4
- scale: 1,
5
- setScale: () => {},
6
- });
7
-
8
- export function usePanelScale(): number {
9
- return useContext(PanelScaleContext).scale;
10
- }
11
- export function usePanelSetScale(): (n: number) => void {
12
- return useContext(PanelScaleContext).setScale;
13
- }
14
-
15
- export function PanelScaleProvider({ children }: { children: ReactNode }) {
16
- const initialScale = parseFloat(localStorage["panelScale"] ?? "1") || 1; // should this be game specific?
17
- const [scale, setScaleState] = useState<number>(initialScale);
18
- const setScale = (n: number) => {
19
- localStorage["panelScale"] = n;
20
- setScaleState(n);
21
- };
22
- return <PanelScaleContext.Provider value={{ scale, setScale }}>{children}</PanelScaleContext.Provider>;
23
- }