@@ -44,6 +44,7 @@ export class InterfaceScale extends Contribution {
44
44
override onStart ( ) : MaybePromise < void > {
45
45
const updateCurrent = ( settings : Settings ) => {
46
46
this . currentSettings = settings ;
47
+ this . updateFontScalingEnabled ( ) ;
47
48
} ;
48
49
this . settingsService . onDidChange ( ( settings ) => updateCurrent ( settings ) ) ;
49
50
this . settingsService . settings ( ) . then ( ( settings ) => updateCurrent ( settings ) ) ;
@@ -120,23 +121,14 @@ export class InterfaceScale extends Contribution {
120
121
this . mainMenuManager . update ( ) ;
121
122
}
122
123
123
- private updateFontSize ( mode : 'increase' | 'decrease' ) : void {
124
- if ( this . currentSettings . autoScaleInterface ) {
125
- mode === 'increase'
126
- ? ( this . currentSettings . interfaceScale += InterfaceScale . ZoomLevel . STEP )
127
- : ( this . currentSettings . interfaceScale -=
128
- InterfaceScale . ZoomLevel . STEP ) ;
129
- } else {
130
- mode === 'increase'
131
- ? ( this . currentSettings . editorFontSize += InterfaceScale . FontSize . STEP )
132
- : ( this . currentSettings . editorFontSize -= InterfaceScale . FontSize . STEP ) ;
133
- }
134
- let newFontScalingEnabled : InterfaceScale . FontScalingEnabled = {
124
+ private updateFontScalingEnabled ( ) : void {
125
+ let fontScalingEnabled = {
135
126
increase : true ,
136
127
decrease : true ,
137
128
} ;
129
+
138
130
if ( this . currentSettings . autoScaleInterface ) {
139
- newFontScalingEnabled = {
131
+ fontScalingEnabled = {
140
132
increase :
141
133
this . currentSettings . interfaceScale + InterfaceScale . ZoomLevel . STEP <=
142
134
InterfaceScale . ZoomLevel . MAX ,
@@ -145,7 +137,7 @@ export class InterfaceScale extends Contribution {
145
137
InterfaceScale . ZoomLevel . MIN ,
146
138
} ;
147
139
} else {
148
- newFontScalingEnabled = {
140
+ fontScalingEnabled = {
149
141
increase :
150
142
this . currentSettings . editorFontSize + InterfaceScale . FontSize . STEP <=
151
143
InterfaceScale . FontSize . MAX ,
@@ -154,14 +146,29 @@ export class InterfaceScale extends Contribution {
154
146
InterfaceScale . FontSize . MIN ,
155
147
} ;
156
148
}
157
- const isChanged = Object . keys ( newFontScalingEnabled ) . some (
149
+
150
+ const isChanged = Object . keys ( fontScalingEnabled ) . some (
158
151
( key : keyof InterfaceScale . FontScalingEnabled ) =>
159
- newFontScalingEnabled [ key ] !== this . fontScalingEnabled [ key ]
152
+ fontScalingEnabled [ key ] !== this . fontScalingEnabled [ key ]
160
153
) ;
161
154
if ( isChanged ) {
162
- this . fontScalingEnabled = newFontScalingEnabled ;
155
+ this . fontScalingEnabled = fontScalingEnabled ;
163
156
this . registerMenus ( this . menuRegistry ) ;
164
157
}
158
+ }
159
+
160
+ private updateFontSize ( mode : 'increase' | 'decrease' ) : void {
161
+ if ( this . currentSettings . autoScaleInterface ) {
162
+ mode === 'increase'
163
+ ? ( this . currentSettings . interfaceScale += InterfaceScale . ZoomLevel . STEP )
164
+ : ( this . currentSettings . interfaceScale -=
165
+ InterfaceScale . ZoomLevel . STEP ) ;
166
+ } else {
167
+ mode === 'increase'
168
+ ? ( this . currentSettings . editorFontSize += InterfaceScale . FontSize . STEP )
169
+ : ( this . currentSettings . editorFontSize -= InterfaceScale . FontSize . STEP ) ;
170
+ }
171
+ this . updateFontScalingEnabled ( ) ;
165
172
this . updateSettingsDebounced ( ) ;
166
173
}
167
174
0 commit comments