diff --git a/src/components/panels/Timelapse/TimelapseStatusPanel.vue b/src/components/panels/Timelapse/TimelapseStatusPanel.vue
index 59b9eec9..5ac64a4c 100644
--- a/src/components/panels/Timelapse/TimelapseStatusPanel.vue
+++ b/src/components/panels/Timelapse/TimelapseStatusPanel.vue
@@ -18,16 +18,19 @@
-
- {{ mdiFile }}
+ :style="webcamStyle"
+ @load="calcRatio" />
+
+
+
+
+ {{ mdiFile }}
+
@@ -39,22 +42,24 @@
align-self="center">
-
+
{{ framesCount }}
-
+
{{ estimatedVideoLength }}
-
+
-
+
@@ -91,7 +96,7 @@
@@ -109,8 +114,7 @@
:items="framerateTypeOptions"
outlined
dense
- hide-details
- attach>
+ hide-details>
@@ -197,16 +201,22 @@ import { Component, Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import Panel from '@/components/ui/Panel.vue'
-import { mdiFile, mdiInformation, mdiTextBoxSearchOutline } from '@mdi/js'
+import { mdiFile, mdiInformation, mdiTextBoxSearchOutline, mdiCloseThick } from '@mdi/js'
@Component({
components: { Panel, SettingsRow },
})
export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
mdiInformation = mdiInformation
mdiFile = mdiFile
+ mdiCloseThick = mdiCloseThick
mdiTextBoxSearchOutline = mdiTextBoxSearchOutline
private boolDialogRendersettings = false
+ private scale = 1
+
+ declare $refs: {
+ timelapsePreview: HTMLImageElement
+ }
get frameUrl() {
const frame = this.$store.state.server.timelapse?.lastFrame?.file ?? null
@@ -308,12 +318,12 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
}
get estimatedVideoLength() {
- let seconds = 0
+ let seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.output_framerate)
if (this.variable_fps) {
seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.variableTargetFps)
if (seconds < this.targetlength) seconds = this.targetlength
- } else seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.output_framerate)
+ }
return seconds > 60
? Math.floor(seconds / 60) + 'm ' + (seconds - Math.floor(seconds / 60) * 60) + 's'
@@ -341,14 +351,14 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
}
get webcamStyle() {
- if (this.camSettings === undefined) return ''
+ let transforms = []
+ const scale = [0, 180].includes(this.camSettings.rotate) ? 1 : this.scale
+ this.camSettings?.flipX ? transforms.push(`scaleX(-${scale})`) : transforms.push(`scaleX(${scale})`)
+ this.camSettings?.flipY ? transforms.push(`scaleY(-${scale})`) : transforms.push(`scaleY(${scale})`)
+ if (this.camSettings.rotate !== 0) transforms.push(`rotate(${this.camSettings.rotate}deg)`)
+ if (transforms.length) return { transform: transforms.join(' ') }
- 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 ''
+ return {}
}
startRender() {
@@ -360,5 +370,14 @@ export default class TimelapseStatusPanel extends Mixins(BaseMixin) {
saveFrames() {
this.$socket.emit('machine.timelapse.saveframes', {}, { loading: 'timelapse_saveframes' })
}
+
+ calcRatio() {
+ if (this.$refs.timelapsePreview) {
+ this.scale = this.$refs.timelapsePreview.naturalHeight / this.$refs.timelapsePreview.naturalWidth
+ if (this.scale > 1) {
+ this.scale = this.$refs.timelapsePreview.naturalWidth / this.$refs.timelapsePreview.naturalHeight
+ }
+ }
+ }
}