-
Notifications
You must be signed in to change notification settings - Fork 327
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
fix(StackViewport): Reset camera bug when rotation happens on StackViewport #374
Conversation
…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.
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -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 |
There was a problem hiding this comment.
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; | |||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this 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
Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks
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.