crystaltoolkit icon indicating copy to clipboard operation
crystaltoolkit copied to clipboard

[Feature Request]: Persistent camera orientation when modifying crystal structure

Open Abhivega opened this issue 2 years ago • 2 comments

Email (Optional)

No response

Problem

In this example, if we rotate the visualized structure interactively and then swap the current structure for another one, the camera orientation is reset.

Proposed Solution

Is there a way to specify a desired view axis, or to make the camera view persistent when the structure is modified?

Alternatives

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Abhivega avatar Sep 12 '23 09:09 Abhivega

Hi @Abhivega, a very reasonable request!

The underlying rendering code is currently a little messy, but to support this feature, a conditional on this.settings (perhaps, this.settings.resetCamera) would have to be added to this line:

https://github.com/materialsproject/mp-react-components/blob/5a54523c600919312929fd513ec93e39e680f5ef/src/components/crystal-toolkit/scene/Scene.ts#L493

and an appropriate default added here:

https://github.com/materialsproject/mp-react-components/blob/5a54523c600919312929fd513ec93e39e680f5ef/src/components/crystal-toolkit/scene/constants.ts#L51

I don't have time to add this myself at present, but pull requests very welcome.

mkhorton avatar Oct 10 '23 00:10 mkhorton