Store/Settings: Handle `uiScale`'s side effects in the module

This commit is contained in:
Svallinn 2021-06-11 02:22:59 +01:00
parent bb64efbe4d
commit b0f973b76a
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
3 changed files with 9 additions and 15 deletions

View File

@ -145,14 +145,6 @@ export default Vue.extend({
localStorage.setItem('expandSideBar', value) localStorage.setItem('expandSideBar', value)
}, },
handleUiScale: function (value) {
// FIXME: No electron safeguard
const { webFrame } = require('electron')
const zoomFactor = value / 100
webFrame.setZoomFactor(zoomFactor)
this.updateUiScale(parseInt(value))
},
handleRestartPrompt: function (value) { handleRestartPrompt: function (value) {
this.disableSmoothScrollingToggleValue = value this.disableSmoothScrollingToggleValue = value
this.showRestartPrompt = true this.showRestartPrompt = true

View File

@ -30,7 +30,7 @@
:max-value="maxUiScale" :max-value="maxUiScale"
:step="uiScaleStep" :step="uiScaleStep"
value-extension="%" value-extension="%"
@change="handleUiScale" @change="updateUiScale(parseInt($event))"
/> />
</ft-flex-box> </ft-flex-box>
<br> <br>

View File

@ -159,7 +159,6 @@ const defaultSideEffectsTriggerId = settingId =>
const state = { const state = {
currentTheme: 'lightRed', currentTheme: 'lightRed',
uiScale: 100,
backendFallback: true, backendFallback: true,
checkForUpdates: true, checkForUpdates: true,
checkForBlogPosts: true, checkForBlogPosts: true,
@ -214,12 +213,15 @@ const state = {
} }
const stateWithSideEffects = { const stateWithSideEffects = {
/* uiScale: {
setting: { defaultValue: 100,
defaultValue: any, sideEffectsHandler: ({ state: { usingElectron } }, value) => {
sideEffectsHandler: (store, settingValue) => void if (usingElectron) {
const { webFrame } = require('electron')
webFrame.setZoomFactor(value / 100)
}
}
} }
*/
} }
const customState = { const customState = {