[Camera UI] React on screen orientation changes to redraw the camera frame.

This commit is contained in:
Fabio Manganiello 2024-07-20 12:07:17 +02:00
parent 6e99e87aa6
commit 15b615efe8
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -185,6 +185,7 @@ export default {
this.$watch(() => this.attrs.rotate, this.onSizeChanged) this.$watch(() => this.attrs.rotate, this.onSizeChanged)
this.$watch(() => this.attrs.scale_x, this.onSizeChanged) this.$watch(() => this.attrs.scale_x, this.onSizeChanged)
this.$watch(() => this.attrs.scale_y, this.onSizeChanged) this.$watch(() => this.attrs.scale_y, this.onSizeChanged)
screen.orientation.addEventListener('change', this.onSizeChanged)
const onOrientationOrSizeChange = () => { const onOrientationOrSizeChange = () => {
this.onSizeChanged() this.onSizeChanged()
@ -194,6 +195,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.resizeObserver = new ResizeObserver(onOrientationOrSizeChange) this.resizeObserver = new ResizeObserver(onOrientationOrSizeChange)
this.resizeObserver.observe(document.body)
this.resizeObserver.observe(this.$refs?.frameContainer?.parentElement) this.resizeObserver.observe(this.$refs?.frameContainer?.parentElement)
}) })
}, },