diff --git a/src/csui/PlayerUiPanels/VideoSettings.vue b/src/csui/PlayerUiPanels/VideoSettings.vue index 5209171..02b275b 100644 --- a/src/csui/PlayerUiPanels/VideoSettings.vue +++ b/src/csui/PlayerUiPanels/VideoSettings.vue @@ -66,13 +66,13 @@ type="range" step="any" min="-1" - max="4" + max="3" :value="zoom.x" @input="changeZoom($event.target.value)" />
- Zoom: {{(zoom.x * 100).toFixed()}}% + Zoom: {{getZoomForDisplay('x')}}
reset @@ -97,14 +97,14 @@ type="range" step="any" min="-1" - max="4" + max="3" :value="zoom.y" @input="changeZoom($event.target.value, 'y')" />
- Zoom: {{(zoom.x * 100).toFixed()}}% x {{(zoom.y * 100).toFixed()}}% + Zoom: {{getZoomForDisplay('x')}} x {{getZoomForDisplay('y')}}
reset @@ -189,6 +189,14 @@ export default { computed: { }, methods: { + getZoomForDisplay(axis) { + // zoom is internally handled logarithmically, because we want to + // have x0.5, x1, x2, x4 ... magnifications spaced out at regular + // intervals. When displaying, we need to conver that back to non- + // logarithmic units. + + return `${ (Math.pow(2, this.zoom[axis]) * 100).toFixed()}%`; + }, async openOptionsPage() { BrowserDetect.runtime.openOptionsPage(); }, @@ -207,12 +215,23 @@ export default { }, resetZoom() { - this.zoom = 1; - this.eventBus.send('set-zoom', {zoom: 1}); + // we store zoom logarithmically on this component + this.zoom = {x: 0, y: 0}; + + // we do not use logarithmic zoom elsewhere + this.eventBus.send('set-zoom', {zoom: 1, axis: 'y'}); + this.eventBus.send('set-zoom', {zoom: 1, axis: 'x'}); }, changeZoom(newZoom, axis) { - newZoom = Math.pow(2, newZoom); + // we store zoom logarithmically on this compnent + if (!axis) { + this.zoom.x = newZoom; + } else { + this.zoom[axis] = newZoom; + } + // we do not use logarithmic zoom elsewhere, therefore we need to convert + newZoom = Math.pow(2, newZoom); this.eventBus.send('set-zoom', {zoom: newZoom, axis: axis, noAnnounce: true}); }, } diff --git a/src/ext/conf/ExtConfPatches.ts b/src/ext/conf/ExtConfPatches.ts index 00d8658..3c23767 100644 --- a/src/ext/conf/ExtConfPatches.ts +++ b/src/ext/conf/ExtConfPatches.ts @@ -123,11 +123,10 @@ const ExtensionConfPatch = [ } } }, { - forVersion: '6.0.0', + forVersion: '6.0.0-alpha1', updateFn: (userOptions: SettingsInterface, defaultOptions) => { - // migrate keyboard settings to the new format: - - // userOptions.actions + // add new commands + userOptions.commands = defaultOptions.commands; } } ];