Skip to content

fix(flip): seperate flip calls #1868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 4, 2025
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
7 changes: 5 additions & 2 deletions packages/core/src/RenderingEngine/Viewport.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

can flip not take null as a value?

Original file line number Diff line number Diff line change
Expand Up @@ -1873,8 +1873,11 @@ class Viewport {
// right now if the view presentation requires a flip, it will flicker. The
// correct way to handle this is to wait for camera and flip together and then
// do one render
if (flipHorizontal || flipVertical) {
this.flip({ flipHorizontal, flipVertical });
if (flipHorizontal !== undefined) {
this.flip({ flipHorizontal });
}
if (flipVertical !== undefined) {
this.flip({ flipVertical });
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions tests/stackAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,16 @@ test.describe('Stack Viewport API', async () => {
screenShotPaths.stackAPI.resetViewport
);
});

test('should flip both h and v and be able to scroll and keep the flip', async ({
page,
}) => {
await page.getByRole('button', { name: 'Flip H' }).click();
await page.getByRole('button', { name: 'Flip V' }).click();

// click on next image
await page.getByRole('button', { name: 'Next Image' }).click();
const locator = page.locator('.cornerstone-canvas');
await checkForScreenshot(page, locator, screenShotPaths.stackAPI.flipBoth);
});
});
1 change: 1 addition & 0 deletions tests/utils/screenShotPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const screenShotPaths = {
viewport: 'viewport.png',
},
stackAPI: {
flipBoth: 'flipBoth.png',
setVoiRange: 'setVoiRange.png',
nextImage: 'nextImage.png',
previousImage: 'previousImage.png',
Expand Down