Skip to content

Commit 0048b29

Browse files
author
Alberto Iannaccone
committed
remove excessive settings duplicate
1 parent a9cc9e3 commit 0048b29

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

arduino-ide-extension/src/browser/contributions/interface-scale.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export class InterfaceScale extends Contribution {
3131
decrease: true,
3232
};
3333

34-
private currentScale: InterfaceScale.ScaleSettings;
3534
private currentSettings: Settings;
3635
private updateSettingsDebounced = debounce(
3736
async () => {
@@ -45,7 +44,6 @@ export class InterfaceScale extends Contribution {
4544
override onStart(): MaybePromise<void> {
4645
const updateCurrent = (settings: Settings) => {
4746
this.currentSettings = settings;
48-
this.currentScale = { ...settings };
4947
};
5048
this.settingsService.onDidChange((settings) => updateCurrent(settings));
5149
this.settingsService.settings().then((settings) => updateCurrent(settings));
@@ -125,18 +123,13 @@ export class InterfaceScale extends Contribution {
125123
private async updateFontSize(mode: 'increase' | 'decrease'): Promise<void> {
126124
if (this.currentSettings.autoScaleInterface) {
127125
mode === 'increase'
128-
? (this.currentScale.interfaceScale += InterfaceScale.ZoomLevel.STEP)
129-
: (this.currentScale.interfaceScale -= InterfaceScale.ZoomLevel.STEP);
126+
? (this.currentSettings.interfaceScale += InterfaceScale.ZoomLevel.STEP)
127+
: (this.currentSettings.interfaceScale -= InterfaceScale.ZoomLevel.STEP);
130128
} else {
131129
mode === 'increase'
132-
? (this.currentScale.editorFontSize += InterfaceScale.FontSize.STEP)
133-
: (this.currentScale.editorFontSize -= InterfaceScale.FontSize.STEP);
130+
? (this.currentSettings.editorFontSize += InterfaceScale.FontSize.STEP)
131+
: (this.currentSettings.editorFontSize -= InterfaceScale.FontSize.STEP);
134132
}
135-
this.currentSettings = {
136-
...this.currentSettings,
137-
editorFontSize: this.currentScale.editorFontSize,
138-
interfaceScale: this.currentScale.interfaceScale,
139-
};
140133
let newFontScalingEnabled: InterfaceScale.FontScalingEnabled = {
141134
increase: true,
142135
decrease: true,
@@ -225,9 +218,4 @@ export namespace InterfaceScale {
225218
increase: boolean;
226219
decrease: boolean;
227220
}
228-
229-
export type ScaleSettings = Pick<
230-
Settings,
231-
'interfaceScale' | 'editorFontSize'
232-
>;
233221
}

0 commit comments

Comments
 (0)