Skip to content

Conversation

@FezVrasta
Copy link
Contributor

When we switch between different mouse adaptors programmatically (directly interacting with the style and view instances) we often get the error:

cannot get getViewMatrix of undefined

This happens on the CubeAxesActor instance, and only happens if showCubeAxes prop is not set to true.

This change prevents the error from happening.

src/core/View.js Outdated
this.resetCamera = this.resetCamera.bind(this);
const bbox = vtkBoundingBox.newInstance({ bounds: [0, 0, 0, 0, 0, 0] });
this.updateCubeBounds = () => {
if (this.props.showCubeAxes !== true) return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we do that instead?

if (!this.props.showCubeAxes) {
  return;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Matter of preferences I suppose, your suggestion will cast any thruty value to false, while mine will explicitly check for a true boolean. I updated my PR to use your version though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks. I think that I use the loose test everywhere else so just to be on the safe side I rather let it be anything. Thanks for the edit.

@FezVrasta FezVrasta force-pushed the fix/getviewmatrix-of-undefined branch from bb3c6dc to c6d7ae6 Compare August 10, 2021 14:36
@jourdain jourdain merged commit 384c14a into Kitware:master Aug 10, 2021
@FezVrasta FezVrasta deleted the fix/getviewmatrix-of-undefined branch August 10, 2021 14:41
@jourdain
Copy link
Collaborator

🎉 This PR is included in version 1.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants