Skip to content
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
12 changes: 12 additions & 0 deletions src/components/players/players/PreviewPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
:style="{
opacity: overlayOpacity
}"
@panzoom-ready="onComparisonPanzoomReady"
@video-loaded="onComparisonVideoLoaded"
v-show="isComparing && previewToCompare"
/>
Expand Down Expand Up @@ -1121,6 +1122,17 @@ const realignComparisonCanvas = () => {
loadComparisonAnnotationAtCurrentFrame()
}

// Push the main viewer's current transform onto the comparison
// viewer once its panzoom instance is (re)bound. The comparison
// binds lazily — on the media's load event after a revision swap —
// so the panzoomTransform watcher (which only fires on changes) had
// no chance to sync the fresh instance back to the main viewer.
const onComparisonPanzoomReady = () => {
if (!isComparing.value) return
const { x, y, scale } = panzoomTransform.value
comparisonViewer.value?.setPanZoom(x, y, scale)
}

const onComparisonVideoLoaded = () => {
syncComparisonViewer()
// The comparison canvas position and size are derived from the
Expand Down
3 changes: 3 additions & 0 deletions src/components/players/viewers/PreviewViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
@duration-changed="duration => $emit('duration-changed', duration)"
@frame-update="frameNumber => $emit('frame-update', frameNumber)"
@panzoom-changed="onVideoPanzoomChanged"
@panzoom-ready="$emit('panzoom-ready')"
@play-ended="$emit('play-ended')"
@size-changed="onVideoSizeChanged"
@video-end="$emit('video-end')"
Expand All @@ -63,6 +64,7 @@
:preview="preview"
@loaded="$emit('picture-loaded')"
@panzoom-changed="onPicturePanzoomChanged"
@panzoom-ready="$emit('panzoom-ready')"
@size-changed="onPictureSizeChanged"
v-show="isPicture"
/>
Expand Down Expand Up @@ -229,6 +231,7 @@ const emit = defineEmits([
'frame-update',
'model-loaded',
'panzoom-changed',
'panzoom-ready',
'picture-loaded',
'play-ended',
'size-changed',
Expand Down
6 changes: 6 additions & 0 deletions src/components/players/viewers/VideoViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const emit = defineEmits([
'duration-changed',
'frame-update',
'panzoom-changed',
'panzoom-ready',
'play-ended',
'size-changed',
'video-end',
Expand Down Expand Up @@ -440,6 +441,11 @@ const setupPanZoom = () => {
panzoomInstance.on('zoom', emitPanZoom)
panzoomInstance.on('pan', emitPanZoom)
if (!panzoomActive) panzoomInstance.pause()
// Tell the parent that a fresh instance exists so the comparison
// sync can re-push the main viewer's transform — without this the
// comparison stays at identity after a revision swap and drifts
// out of sync with the main viewer.
emit('panzoom-ready')
}

const pausePanZoom = () => {
Expand Down