Add zoom setting

This commit is contained in:
Geomitron
2024-07-11 17:08:36 -05:00
parent 1f7184dcc3
commit 2d9fad5d03
6 changed files with 80 additions and 39 deletions

View File

@@ -1,9 +1,10 @@
import { DOCUMENT } from '@angular/common'
import { Inject, Injectable } from '@angular/core'
import _ from 'lodash'
import { Difficulty, Instrument } from 'scan-chart'
import { Settings, themes } from '../../../../src-shared/Settings'
import { Settings, themes } from '../../../../src-shared/Settings.js'
@Injectable({
providedIn: 'root',
@@ -90,4 +91,20 @@ export class SettingsService {
this.settings.isCompactTable = value
this.saveSettings()
}
get zoomFactor() {
return this.settings.zoomFactor
}
set zoomFactor(value: number) {
this.settings.zoomFactor = value
this.saveSettings()
}
zoomIn() {
this.zoomFactor = _.round(this.zoomFactor + 0.1, 3)
}
zoomOut() {
if (_.round(this.zoomFactor - 0.1, 3) > 0) {
this.zoomFactor = _.round(this.zoomFactor - 0.1, 3)
}
}
}