fix: use webcam settings for TL preview image (rotation/mirror)

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-11-27 01:27:58 +01:00
1 parent d4b1be9fcc
commit 64f7c2bebd
3 files changed
+27 -14

No files matched your search

@@ -16,7 +16,7 @@
<v-row>
<v-col>
<vue-load-image>
<img slot="image" :src="frameUrl" :alt="$t('Timelapse.Preview')" class="w-100" />
<img slot="image" :src="frameUrl" :alt="$t('Timelapse.Preview')" class="w-100" :style="webcamStyle" />
<v-progress-circular slot="preloader" indeterminate color="primary"></v-progress-circular>
<v-icon slot="error">mdi-file</v-icon>
</vue-load-image>
@@ -294,6 +294,25 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
return ((this.$store.state.server.timelapse?.rendering.status ?? '') === 'running')
}
get camId() {
return this.$store.state.server.timelapse.settings.camera ?? ''
}
get camSettings() {
return this.$store.getters['gui/webcams/getWebcam'](this.camId)
}
get webcamStyle() {
if (this.camSettings === undefined) return ''
let transforms = ''
if ('flipX' in this.camSettings && this.camSettings.flipX) transforms += ' scaleX(-1)'
if ('flipX' in this.camSettings && this.camSettings.flipY) transforms += ' scaleY(-1)'
if (transforms.trimLeft().length) return { transform: transforms.trimLeft() }
return ''
}
startRender() {
this.boolDialogRendersettings = false
@@ -106,10 +106,6 @@
</settings-row>
</template>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.TimelapseTab.Rotation')" :sub-title="$t('Settings.TimelapseTab.RotationDescription')">
<v-text-field v-model="rotation" type="number" hide-details="auto" outlined dense :disabled="blockedsettings.includes('rotation')"></v-text-field>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.TimelapseTab.duplicatelastframe')" :sub-title="$t('Settings.TimelapseTab.duplicatelastframeDescription')">
<v-text-field v-model="duplicatelastframe" type="number" hide-details="auto" outlined dense :disabled="blockedsettings.includes('duplicatelastframe')"></v-text-field>
</settings-row>
@@ -402,14 +398,6 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
this.$store.dispatch('server/timelapse/saveSetting', { variable_fps_max: newVal })
}
get rotation() {
return this.$store.state.server.timelapse.settings.rotation
}
set rotation(newVal) {
this.$store.dispatch('server/timelapse/saveSetting', { rotation: newVal })
}
get duplicatelastframe() {
return this.$store.state.server.timelapse.settings.duplicatelastframe
}
+7 -1
View File
@@ -3,7 +3,7 @@ import {GuiWebcamState, GuiWebcamStateWebcam} from '@/store/gui/webcams/types'
// eslint-disable-next-line
export const getters: GetterTree<GuiWebcamState, any> = {
getWebcams:(state) => {
getWebcams: (state) => {
const webcams: GuiWebcamStateWebcam[] = []
Object.keys(state.webcams).forEach((id: string) => {
@@ -12,4 +12,10 @@ export const getters: GetterTree<GuiWebcamState, any> = {
return webcams
},
getWebcam: (state, getters) => (camId: string) => {
const webcams = getters['getWebcams'] ?? []
return webcams.find((webcam:GuiWebcamStateWebcam) => webcam.id === camId)
}
}