@@ -44,6 +44,7 @@ export class InterfaceScale extends Contribution {
4444 override onStart ( ) : MaybePromise < void > {
4545 const updateCurrent = ( settings : Settings ) => {
4646 this . currentSettings = settings ;
47+ this . updateFontScalingEnabled ( ) ;
4748 } ;
4849 this . settingsService . onDidChange ( ( settings ) => updateCurrent ( settings ) ) ;
4950 this . settingsService . settings ( ) . then ( ( settings ) => updateCurrent ( settings ) ) ;
@@ -120,23 +121,14 @@ export class InterfaceScale extends Contribution {
120121 this . mainMenuManager . update ( ) ;
121122 }
122123
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 = {
135126 increase : true ,
136127 decrease : true ,
137128 } ;
129+
138130 if ( this . currentSettings . autoScaleInterface ) {
139- newFontScalingEnabled = {
131+ fontScalingEnabled = {
140132 increase :
141133 this . currentSettings . interfaceScale + InterfaceScale . ZoomLevel . STEP <=
142134 InterfaceScale . ZoomLevel . MAX ,
@@ -145,7 +137,7 @@ export class InterfaceScale extends Contribution {
145137 InterfaceScale . ZoomLevel . MIN ,
146138 } ;
147139 } else {
148- newFontScalingEnabled = {
140+ fontScalingEnabled = {
149141 increase :
150142 this . currentSettings . editorFontSize + InterfaceScale . FontSize . STEP <=
151143 InterfaceScale . FontSize . MAX ,
@@ -154,14 +146,29 @@ export class InterfaceScale extends Contribution {
154146 InterfaceScale . FontSize . MIN ,
155147 } ;
156148 }
157- const isChanged = Object . keys ( newFontScalingEnabled ) . some (
149+
150+ const isChanged = Object . keys ( fontScalingEnabled ) . some (
158151 ( key : keyof InterfaceScale . FontScalingEnabled ) =>
159- newFontScalingEnabled [ key ] !== this . fontScalingEnabled [ key ]
152+ fontScalingEnabled [ key ] !== this . fontScalingEnabled [ key ]
160153 ) ;
161154 if ( isChanged ) {
162- this . fontScalingEnabled = newFontScalingEnabled ;
155+ this . fontScalingEnabled = fontScalingEnabled ;
163156 this . registerMenus ( this . menuRegistry ) ;
164157 }
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 ( ) ;
165172 this . updateSettingsDebounced ( ) ;
166173 }
167174
0 commit comments