Skip to content
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

fix(StackViewport): Reset camera bug when rotation happens on StackViewport #374

Conversation

jbocce
Copy link
Contributor

@jbocce jbocce commented Jan 18, 2023

For a GPU reset, start by resetting the flips and rotation (via viewUp) because the ordering of the various flips and rotations that have been applied is not known.

…happens on StackViewport

For a GPU reset, start by resetting the flips and rotation (via viewUp) because
the ordering of the various flips and rotations that have been applied is not known.
@netlify
Copy link

netlify bot commented Jan 18, 2023

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 264ae3d
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/63cee0b8852ca70007760ffe
😎 Deploy Preview https://deploy-preview-374--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@jbocce jbocce marked this pull request as ready for review January 18, 2023 18:01
@jbocce jbocce requested a review from sedghi January 18, 2023 18:01
@@ -1748,6 +1751,9 @@ class StackViewport extends Viewport implements IStackViewport {

this.setCameraNoEvent({ viewUp, viewPlaneNormal });

// Setting this makes the following comment about resetCameraNoEvent not modifying viewUp true.
this.initialViewUp = viewUp;

// Reset the camera to point to the new slice location, reset camera doesn't
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prior to my changes, this comment was not true. viewUp was getting changed via a call to camera.roll.

@@ -155,6 +155,9 @@ class StackViewport extends Viewport implements IStackViewport {
public modality: string; // this is needed for tools
public scaling: Scaling;

// Camera properties
private initialViewUp: Point3;

Copy link
Member

Choose a reason for hiding this comment

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

I think we should this.initialViewUp= inside the constructor as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed

@@ -1883,7 +1889,14 @@ class StackViewport extends Viewport implements IStackViewport {
// Todo: we need to make the rotation a camera properties so that
// we can reset it there, right now it is not possible to reset the rotation
// without this
this.getVtkActiveCamera().roll(this.rotationCache);
if (this.initialViewUp) {
Copy link
Member

Choose a reason for hiding this comment

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

if you set it in the constructor you don't need this if here, since it will always be defined

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

Great work. See my comments please

@jbocce
Copy link
Contributor Author

jbocce commented Jan 23, 2023

Great work. See my comments please

Thank you.

Copy link
Member

@sedghi sedghi 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, thanks

@sedghi sedghi changed the title fix(StackViewport): #372 Reset camera bug when rotation happens on StackViewport fix(StackViewport): Reset camera bug when rotation happens on StackViewport Jan 23, 2023
@sedghi sedghi merged commit 598e95f into cornerstonejs:main Jan 23, 2023
@jbocce jbocce deleted the fix/#372-reset-camera-bug-when-rotation-happens-on-stackViewport branch January 27, 2023 14:02
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