Skip to content

fix(tools): sync flip state from source viewport to magnify viewport#2705

Merged
jbocce merged 2 commits intocornerstonejs:mainfrom
GhadeerAlbattarni:fix/flip-orientation
Apr 21, 2026
Merged

fix(tools): sync flip state from source viewport to magnify viewport#2705
jbocce merged 2 commits intocornerstonejs:mainfrom
GhadeerAlbattarni:fix/flip-orientation

Conversation

@GhadeerAlbattarni
Copy link
Copy Markdown
Contributor

Context

This fixes a bug in OHIF :
OHIF/Viewers#5646

When a viewport is flipped horizontally, the magnify tools render the image without applying the flip. This causes the magnified view to not match the source viewport.

Changes & Results

  • MagnifyTool: extract flipHorizontal and flipVertical from getViewPresentation() and include them in setViewPresentation() on the magnify viewport
  • AdvancedMagnifyTool: read flipHorizontal and flipVertical from sourceViewport.getCamera() and pass them to magnifyViewport.setCamera() in _syncViewportsCameras()
flip-orientation-after.mov

Testing

  • open a study
  • click on flip horizontal
  • click on zoom-in tool (MagnifyTool)
  • verify the magnified image reflects the flip

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • OS: macOS 10.15.4
  • Node version: v22.13.0
  • Browser: Chrome 83.0.4103.116

…nd AdvancedMagnifyTool

MagnifyTool was not propagating flipHorizontal/flipVertical when
creating the magnify viewport. AdvancedMagnifyTool was not passing
flip state in _syncViewportsCameras, causing the magnify viewport
to always render in the unflipped orientation regardless of the
source viewport's flip state.
@jbocce jbocce self-requested a review April 21, 2026 14:23
Copy link
Copy Markdown
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I also tested this is OHIF.

@jbocce jbocce merged commit a04369f into cornerstonejs:main Apr 21, 2026
11 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.

2 participants