diff --git a/src/components/mixins/annotation.js b/src/components/mixins/annotation.js index 3307546d1..9fbb729d6 100644 --- a/src/components/mixins/annotation.js +++ b/src/components/mixins/annotation.js @@ -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 }, @@ -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() } }, diff --git a/src/components/previews/PreviewPlayer.vue b/src/components/previews/PreviewPlayer.vue index 78287cceb..c18636a46 100644 --- a/src/components/previews/PreviewPlayer.vue +++ b/src/components/previews/PreviewPlayer.vue @@ -1230,6 +1230,7 @@ export default { }, onProgressChanged(frame) { + this.reloadAnnotations() if (this.currentFrame !== frame) { this.clearCanvas() this.setCurrentFrame(frame) diff --git a/src/components/previews/VideoViewer.vue b/src/components/previews/VideoViewer.vue index 0c72b7b6b..1028f6b4e 100644 --- a/src/components/previews/VideoViewer.vue +++ b/src/components/previews/VideoViewer.vue @@ -522,6 +522,9 @@ export default { this.pause() this.$nextTick(() => { this.resetPanZoom() + setTimeout(() => { + this.resetPanZoom() + }, 100) }) },