@@ -27,6 +27,8 @@ the window, then enlarge it and retain the original widths of the layout.
27
27
import Resizer from ' $components/Resizer.svelte' ;
28
28
import { Focusable } from ' $lib/focus/focusManager.svelte' ;
29
29
import { focusable } from ' $lib/focus/focusable.svelte' ;
30
+ import { SETTINGS , type Settings } from ' $lib/settings/userSettings' ;
31
+ import { getContextStoreBySymbol } from ' @gitbutler/shared/context' ;
30
32
import { persisted } from ' @gitbutler/shared/persisted' ;
31
33
import { pxToRem } from ' @gitbutler/ui/utils/pxToRem' ;
32
34
import type { Snippet } from ' svelte' ;
@@ -48,19 +50,22 @@ the window, then enlarge it and retain the original widths of the layout.
48
50
49
51
const { name, left, middle, right, leftWidth, rightWidth }: Props = $props ();
50
52
53
+ const userSettings = getContextStoreBySymbol <Settings >(SETTINGS );
54
+ const zoom = $derived ($userSettings .zoom );
55
+
51
56
let leftPreferredWidth = $derived (
52
- persisted (pxToRem (leftWidth .default ), ` $main_view_left_${name } ` )
57
+ persisted (pxToRem (leftWidth .default , zoom ), ` $main_view_left_${name } ` )
53
58
);
54
59
let rightPreferredWidth = $derived (
55
- persisted (pxToRem (rightWidth .default ), ` $main_view_right_${name } ` )
60
+ persisted (pxToRem (rightWidth .default , zoom ), ` $main_view_right_${name } ` )
56
61
);
57
62
58
63
let leftDiv = $state <HTMLDivElement >();
59
64
let middleDiv = $state <HTMLDivElement >();
60
65
let rightDiv = $state <HTMLDivElement >();
61
66
62
- const leftMinWidth = $derived (pxToRem (leftWidth .min ));
63
- const rightMinWidth = $derived (pxToRem (rightWidth .min ));
67
+ const leftMinWidth = $derived (pxToRem (leftWidth .min , zoom ));
68
+ const rightMinWidth = $derived (pxToRem (rightWidth .min , zoom ));
64
69
65
70
// These need to stay in px since they are bound to elements.
66
71
let containerBindWidth = $state <number >(1000 ); // TODO: What initial value should we give this?
@@ -74,25 +79,25 @@ the window, then enlarge it and retain the original widths of the layout.
74
79
75
80
// Total width we cannot go below.
76
81
const padding = $derived (containerBindWidth - window .innerWidth );
77
- const containerMinWidth = $derived (800 - padding );
82
+ const containerMinWidth = $derived (804 - padding );
78
83
79
- const middleMinWidth = $derived (pxToRem (containerMinWidth ) - leftMinWidth - rightMinWidth );
84
+ const middleMinWidth = $derived (pxToRem (containerMinWidth , zoom ) - leftMinWidth - rightMinWidth );
80
85
81
86
// Left side max width depends on teh size of the right side, unless
82
87
// `reverse` is true.
83
88
const leftMaxWidth = $derived (
84
- pxToRem (containerBindWidth ) -
89
+ pxToRem (containerBindWidth , zoom ) -
85
90
middleMinWidth -
86
- (reverse ? rightMinWidth : pxToRem (rightBindWidth )) -
91
+ (reverse ? rightMinWidth : pxToRem (rightBindWidth , zoom )) -
87
92
1 // From the flex box gaps
88
93
);
89
94
90
95
// Right side has priority over the left (unless `reverse` is true), so
91
96
// its max size is the theoretical max.
92
97
const rightMaxWidth = $derived (
93
- pxToRem (containerBindWidth ) -
98
+ pxToRem (containerBindWidth , zoom ) -
94
99
middleMinWidth -
95
- (reverse ? pxToRem (leftBindWidth ) : leftMinWidth ) -
100
+ (reverse ? pxToRem (leftBindWidth , zoom ) : leftMinWidth ) -
96
101
1 // From the flex box gaps
97
102
);
98
103
@@ -126,14 +131,14 @@ the window, then enlarge it and retain the original widths of the layout.
126
131
borderRadius =" ml"
127
132
onWidth ={(value ) => {
128
133
leftPreferredWidth .set (value );
129
- rightPreferredWidth .set (pxToRem (rightBindWidth ));
134
+ rightPreferredWidth .set (pxToRem (rightBindWidth , zoom ));
130
135
}}
131
136
onResizing ={(isResizing ) => {
132
137
if (isResizing ) {
133
138
// Before flipping the reverse bool we need to set the
134
139
// preferred width to the actual width, to prevent content
135
140
// from shifting.
136
- leftPreferredWidth .set (pxToRem (leftBindWidth ));
141
+ leftPreferredWidth .set (pxToRem (leftBindWidth , zoom ));
137
142
}
138
143
reverse = isResizing ;
139
144
}}
@@ -165,7 +170,7 @@ the window, then enlarge it and retain the original widths of the layout.
165
170
borderRadius =" ml"
166
171
onWidth ={(value ) => {
167
172
rightPreferredWidth .set (value );
168
- leftPreferredWidth .set (pxToRem (leftBindWidth ));
173
+ leftPreferredWidth .set (pxToRem (leftBindWidth , zoom ));
169
174
}}
170
175
/>
171
176
</div >
0 commit comments