Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Firefox freezes on macOS #1193

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/previews/PictureViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,16 @@ export default {

this.resetPanZoom()

this.$emit('size-changed', { width, height, top, left })
if (
!this.previousDimensions ||
this.previousDimensions.width !== width ||
this.previousDimensions.height !== height ||
this.previousDimensions.left !== left ||
this.previousDimensions.top !== top
) {
this.$emit('size-changed', { width, height, top, left })
}
this.previousDimensions = { width, height, top, left }
}
},

Expand Down
51 changes: 24 additions & 27 deletions src/components/previews/PreviewPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1122,34 +1122,31 @@ export default {
},

fixCanvasSize(dimensions) {
if (this.fabricCanvas) {
const { height, left, top, width } = dimensions

this.fabricCanvas.setDimensions({ width, height })
this.fabricCanvas.width = width
this.fabricCanvas.height = height

if (this.canvasWrapper) {
this.canvasWrapper.style.top = top + 'px'
this.canvasWrapper.style.left = left + 'px'
this.canvasWrapper.style.width = width + 'px'
this.canvasWrapper.style.height = height + 'px'
setTimeout(() => {
this.fabricCanvas.calcOffset()
this.fabricCanvas.setDimensions({ width, height })
this.width = this.getDimensions().width
if (this.isComparing && !this.isComparisonOverlay) {
this.canvasComparisonWrapper.style.top = top + 'px'
this.canvasComparisonWrapper.style.left = left + width + 'px'
this.canvasComparisonWrapper.style.width = width + 'px'
this.canvasComparisonWrapper.style.height = height + 'px'
this.fabricCanvasComparison.calcOffset()
this.fabricCanvasComparison.setDimensions({ width, height })
}
this.$nextTick(this.refreshCanvas())
}, 10)
}
if (!this.fabricCanvas) {
return
}

const { height, left, top, width } = dimensions

this.canvasWrapper.style.top = top + 'px'
this.canvasWrapper.style.left = left + 'px'
this.canvasWrapper.style.width = width + 'px'
this.canvasWrapper.style.height = height + 'px'
// const calcOffset = this.fabricCanvas.calcOffset()
this.fabricCanvas.setDimensions({ width, height })

this.width = this.getDimensions().width

if (this.isComparing && !this.isComparisonOverlay) {
this.canvasComparisonWrapper.style.top = top + 'px'
this.canvasComparisonWrapper.style.left = left + width + 'px'
this.canvasComparisonWrapper.style.width = width + 'px'
this.canvasComparisonWrapper.style.height = height + 'px'
// this.fabricCanvasComparison.calcOffset()
this.fabricCanvasComparison.setDimensions({ width, height })
}

this.refreshCanvas()
},

// Screen
Expand Down
12 changes: 11 additions & 1 deletion src/components/previews/VideoViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,17 @@ export default {
const left = videoPosition.left - containerPosition.left
width = videoPosition.width
height = videoPosition.height
this.$emit('size-changed', { width, height, top, left })

if (
!this.previousDimensions ||
this.previousDimensions.width !== width ||
this.previousDimensions.height !== height ||
this.previousDimensions.left !== left ||
this.previousDimensions.top !== top
) {
this.$emit('size-changed', { width, height, top, left })
}
this.previousDimensions = { width, height, top, left }
} else {
this.$emit('size-changed', { width: 0, height: 0, top: 0, left: 0 })
}
Expand Down