diff --git a/packages/core/src/RenderingEngine/Viewport.ts b/packages/core/src/RenderingEngine/Viewport.ts index 9b82857add..ac4f526d5e 100644 --- a/packages/core/src/RenderingEngine/Viewport.ts +++ b/packages/core/src/RenderingEngine/Viewport.ts @@ -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 }); } } diff --git a/tests/screenshots/Mobile-Android/stackAPI.spec.ts/flipBoth.png b/tests/screenshots/Mobile-Android/stackAPI.spec.ts/flipBoth.png new file mode 100644 index 0000000000..e1a8365eac Binary files /dev/null and b/tests/screenshots/Mobile-Android/stackAPI.spec.ts/flipBoth.png differ diff --git a/tests/screenshots/Mobile-Safari/stackAPI.spec.ts/flipBoth.png b/tests/screenshots/Mobile-Safari/stackAPI.spec.ts/flipBoth.png new file mode 100644 index 0000000000..f7067e25c1 Binary files /dev/null and b/tests/screenshots/Mobile-Safari/stackAPI.spec.ts/flipBoth.png differ diff --git a/tests/screenshots/chromium/stackAPI.spec.ts/flipBoth.png b/tests/screenshots/chromium/stackAPI.spec.ts/flipBoth.png new file mode 100644 index 0000000000..c6642d62bb Binary files /dev/null and b/tests/screenshots/chromium/stackAPI.spec.ts/flipBoth.png differ diff --git a/tests/screenshots/webkit/stackAPI.spec.ts/flipBoth.png b/tests/screenshots/webkit/stackAPI.spec.ts/flipBoth.png new file mode 100644 index 0000000000..0a0c784a04 Binary files /dev/null and b/tests/screenshots/webkit/stackAPI.spec.ts/flipBoth.png differ diff --git a/tests/stackAPI.spec.ts b/tests/stackAPI.spec.ts index caca0280b1..a0d0de35fa 100644 --- a/tests/stackAPI.spec.ts +++ b/tests/stackAPI.spec.ts @@ -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); + }); }); diff --git a/tests/utils/screenShotPaths.ts b/tests/utils/screenShotPaths.ts index 143dc219fa..d6d601fdff 100644 --- a/tests/utils/screenShotPaths.ts +++ b/tests/utils/screenShotPaths.ts @@ -15,6 +15,7 @@ const screenShotPaths = { viewport: 'viewport.png', }, stackAPI: { + flipBoth: 'flipBoth.png', setVoiRange: 'setVoiRange.png', nextImage: 'nextImage.png', previousImage: 'previousImage.png',