Skip to content

[players] Reset pan/zoom and load sub-preview annotations on preview switch#2058

Merged
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:fix-playlist-preview-switch
Jun 17, 2026
Merged

[players] Reset pan/zoom and load sub-preview annotations on preview switch#2058
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:fix-playlist-preview-switch

Conversation

@frankrousseau

Copy link
Copy Markdown
Contributor

Problems

  • Pan/zoom not reset for annotations on switch. Switching entity, sub-preview or version reset the viewer's pan/zoom but not panzoomTransform, which drives AnnotationCanvas. resetPanZoom() resets the viewer silently (PictureViewer.setPanZoom runs with silent=true, emitting no panzoom-changed), so the annotation transform kept the previous pan/zoom and annotations were left offset/zoomed.
  • Sub-previews no longer loaded their annotations (regression from moving annotations out of the playlist payload): the on-demand loader only handled the entity's main preview.

Solutions

  • Reset panzoomTransform alongside resetPanZoom() in the currentPreviewIndex and playingEntityIndex watchers and in changePreviewFile (version switch); add a currentPreview.id reset watcher in SharedPlaylistPlayer.
  • Generalise the lazy loader (ensureCurrentPreviewAnnotations) to load the current preview's annotations whether it is the main preview or a sub-preview. The guest player keeps annotations inline, so it is unaffected by the regression.

…switch

Two bugs when switching the displayed preview in the playlist players:

- Pan/zoom was not reset for annotations on entity / sub-preview / version
  switch. resetPanZoom() resets the viewer silently (PictureViewer.setPanZoom
  runs with silent=true and emits no panzoom-changed), so panzoomTransform —
  which drives AnnotationCanvas — kept the previous transform and annotations
  stayed offset/zoomed. Reset panzoomTransform alongside resetPanZoom in the
  currentPreviewIndex and playingEntityIndex watchers and in changePreviewFile
  (version switch), and add a currentPreview.id reset watcher in
  SharedPlaylistPlayer.

- Sub-previews no longer loaded their annotations: since annotations were
  removed from the playlist payload, the on-demand loader only handled the
  entity's main preview. Generalise it (ensureCurrentPreviewAnnotations) to
  load the current preview's annotations whether it is the main or a
  sub-preview. (Guest player keeps annotations inline, so it is unaffected.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@frankrousseau frankrousseau merged commit 8c04b07 into cgwire:main Jun 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant