File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 104104 :style =" {
105105 opacity: overlayOpacity
106106 }"
107+ @panzoom-ready =" onComparisonPanzoomReady"
107108 @video-loaded =" onComparisonVideoLoaded"
108109 v-show =" isComparing && previewToCompare"
109110 />
@@ -1121,6 +1122,17 @@ const realignComparisonCanvas = () => {
11211122 loadComparisonAnnotationAtCurrentFrame ()
11221123}
11231124
1125+ // Push the main viewer's current transform onto the comparison
1126+ // viewer once its panzoom instance is (re)bound. The comparison
1127+ // binds lazily — on the media's load event after a revision swap —
1128+ // so the panzoomTransform watcher (which only fires on changes) had
1129+ // no chance to sync the fresh instance back to the main viewer.
1130+ const onComparisonPanzoomReady = () => {
1131+ if (! isComparing .value ) return
1132+ const { x , y , scale } = panzoomTransform .value
1133+ comparisonViewer .value ? .setPanZoom (x, y, scale)
1134+ }
1135+
11241136const onComparisonVideoLoaded = () => {
11251137 syncComparisonViewer ()
11261138 // The comparison canvas position and size are derived from the
Original file line number Diff line number Diff line change 4444 @duration-changed =" duration => $emit('duration-changed', duration)"
4545 @frame-update =" frameNumber => $emit('frame-update', frameNumber)"
4646 @panzoom-changed =" onVideoPanzoomChanged"
47+ @panzoom-ready =" $emit('panzoom-ready')"
4748 @play-ended =" $emit('play-ended')"
4849 @size-changed =" onVideoSizeChanged"
4950 @video-end =" $emit('video-end')"
6364 :preview =" preview"
6465 @loaded =" $emit('picture-loaded')"
6566 @panzoom-changed =" onPicturePanzoomChanged"
67+ @panzoom-ready =" $emit('panzoom-ready')"
6668 @size-changed =" onPictureSizeChanged"
6769 v-show =" isPicture"
6870 />
@@ -229,6 +231,7 @@ const emit = defineEmits([
229231 ' frame-update' ,
230232 ' model-loaded' ,
231233 ' panzoom-changed' ,
234+ ' panzoom-ready' ,
232235 ' picture-loaded' ,
233236 ' play-ended' ,
234237 ' size-changed' ,
Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ const emit = defineEmits([
120120 ' duration-changed' ,
121121 ' frame-update' ,
122122 ' panzoom-changed' ,
123+ ' panzoom-ready' ,
123124 ' play-ended' ,
124125 ' size-changed' ,
125126 ' video-end' ,
@@ -440,6 +441,11 @@ const setupPanZoom = () => {
440441 panzoomInstance .on (' zoom' , emitPanZoom)
441442 panzoomInstance .on (' pan' , emitPanZoom)
442443 if (! panzoomActive) panzoomInstance .pause ()
444+ // Tell the parent that a fresh instance exists so the comparison
445+ // sync can re-push the main viewer's transform — without this the
446+ // comparison stays at identity after a revision swap and drifts
447+ // out of sync with the main viewer.
448+ emit (' panzoom-ready' )
443449}
444450
445451const pausePanZoom = () => {
You can’t perform that action at this time.
0 commit comments