aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/graph/export/ExportSettingsStore.ts
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/graph/export/ExportSettingsStore.ts')
-rw-r--r--subprojects/frontend/src/graph/export/ExportSettingsStore.ts44
1 files changed, 36 insertions, 8 deletions
diff --git a/subprojects/frontend/src/graph/export/ExportSettingsStore.ts b/subprojects/frontend/src/graph/export/ExportSettingsStore.ts
index 53a161ab..7c691a7b 100644
--- a/subprojects/frontend/src/graph/export/ExportSettingsStore.ts
+++ b/subprojects/frontend/src/graph/export/ExportSettingsStore.ts
@@ -7,18 +7,21 @@
7import { makeAutoObservable } from 'mobx'; 7import { makeAutoObservable } from 'mobx';
8 8
9export type ExportFormat = 'svg' | 'pdf' | 'png'; 9export type ExportFormat = 'svg' | 'pdf' | 'png';
10export type ExportTheme = 'light' | 'dark'; 10export type StaticTheme = 'light' | 'dark';
11export type ExportTheme = StaticTheme | 'dynamic';
11 12
12export default class ExportSettingsStore { 13export default class ExportSettingsStore {
13 format: ExportFormat = 'svg'; 14 format: ExportFormat = 'svg';
14 15
15 theme: ExportTheme = 'light'; 16 private staticTheme: StaticTheme = 'light';
16 17
17 transparent = true; 18 private _theme: ExportTheme = 'light';
18 19
19 embedSVGFonts = false; 20 private _transparent = true;
20 21
21 embedPDFFonts = true; 22 private embedSVGFonts = false;
23
24 private embedPDFFonts = true;
22 25
23 scale = 100; 26 scale = 100;
24 27
@@ -31,11 +34,14 @@ export default class ExportSettingsStore {
31 } 34 }
32 35
33 setTheme(theme: ExportTheme): void { 36 setTheme(theme: ExportTheme): void {
34 this.theme = theme; 37 this._theme = theme;
38 if (theme !== 'dynamic') {
39 this.staticTheme = theme;
40 }
35 } 41 }
36 42
37 toggleTransparent(): void { 43 toggleTransparent(): void {
38 this.transparent = !this.transparent; 44 this._transparent = !this._transparent;
39 } 45 }
40 46
41 toggleEmbedFonts(): void { 47 toggleEmbedFonts(): void {
@@ -46,7 +52,18 @@ export default class ExportSettingsStore {
46 this.scale = scale; 52 this.scale = scale;
47 } 53 }
48 54
55 get theme(): ExportTheme {
56 return this.format === 'svg' ? this._theme : this.staticTheme;
57 }
58
59 get transparent(): boolean {
60 return this.theme === 'dynamic' ? true : this._transparent;
61 }
62
49 get embedFonts(): boolean { 63 get embedFonts(): boolean {
64 if (this.theme === 'dynamic') {
65 return false;
66 }
50 return this.format === 'pdf' ? this.embedPDFFonts : this.embedSVGFonts; 67 return this.format === 'pdf' ? this.embedPDFFonts : this.embedSVGFonts;
51 } 68 }
52 69
@@ -57,8 +74,19 @@ export default class ExportSettingsStore {
57 this.embedSVGFonts = embedFonts; 74 this.embedSVGFonts = embedFonts;
58 } 75 }
59 76
77 get canSetDynamicTheme(): boolean {
78 return this.format === 'svg';
79 }
80
81 get canChangeTransparency(): boolean {
82 return this.theme !== 'dynamic';
83 }
84
60 get canEmbedFonts(): boolean { 85 get canEmbedFonts(): boolean {
61 return this.format === 'svg' || this.format === 'pdf'; 86 return (
87 (this.format === 'svg' || this.format === 'pdf') &&
88 this.theme !== 'dynamic'
89 );
62 } 90 }
63 91
64 get canScale(): boolean { 92 get canScale(): boolean {