Skip to content

Commit

Permalink
Merge pull request #1677 from frankrousseau/main
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
frankrousseau authored Jan 22, 2025
2 parents 38d8f6f + 75f07f6 commit e17e7f1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/components/mixins/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1306,9 +1306,17 @@ export const annotationMixin = {
copyAnnotations() {
if (!this.fabricCanvas) return
const activeObject = this.fabricCanvas.getActiveObject()
if (activeObject) {
const obj = Object.create(activeObject)
clipboard.copyAnnotations(obj)
if (!activeObject) return
if (activeObject._objects) {
clipboard.copyAnnotations({
mainObject: activeObject,
subObjects: [...activeObject._objects]
})
} else {
clipboard.copyAnnotations({
mainObject: Object.create(activeObject),
subObjects: []
})
}
return activeObject
},
Expand All @@ -1319,17 +1327,17 @@ export const annotationMixin = {
pasteAnnotations() {
if (!this.fabricCanvas) return
this.fabricCanvas.discardActiveObject()
const clonedObj = clipboard.pasteAnnotations()
if (clonedObj._objects) {
clonedObj._objects.forEach(obj => {
obj = this.applyGroupChanges(clonedObj, obj)
const { mainObject, subObjects } = clipboard.pasteAnnotations()
if (subObjects.length > 0) {
subObjects.forEach(obj => {
obj = this.applyGroupChanges(mainObject, obj)
obj.group = null
this.addObject(obj)
})
this.fabricCanvas.requestRenderAll()
} else {
this.addObject(clonedObj)
this.fabricCanvas.setActiveObject(clonedObj)
this.addObject(mainObject)
this.fabricCanvas.setActiveObject(mainObject)
this.fabricCanvas.requestRenderAll()
}
},
Expand Down
1 change: 1 addition & 0 deletions src/components/previews/PreviewPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,7 @@ export default {
},
onProgressChanged(frame) {
this.reloadAnnotations()
if (this.currentFrame !== frame) {
this.clearCanvas()
this.setCurrentFrame(frame)
Expand Down
3 changes: 3 additions & 0 deletions src/components/previews/VideoViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,9 @@ export default {
this.pause()
this.$nextTick(() => {
this.resetPanZoom()
setTimeout(() => {
this.resetPanZoom()
}, 100)
})
},
Expand Down

0 comments on commit e17e7f1

Please sign in to comment.