dsehnal / LiteMol

A library/plugin for handling 3D structural molecular data (not only) in the browser.
Other
157 stars 38 forks source link

Serialize/restore camera state for persisted scene #51

Closed suyang-nju closed 5 years ago

suyang-nju commented 5 years ago

I can get the camera state by subscribing to Event.Visual.CameraChanged event. How do I serialize the camera state and restore it to the scene later? Basically, I'd like to persist the scene across user sessions.

dsehnal commented 5 years ago

This should be possible by using plugin.context.scene.scene.camera.snapshot/restore functions (https://github.com/dsehnal/LiteMol/blob/master/src/lib/Visualization/Base/Camera.ts#L237).

suyang-nju commented 5 years ago

Thank you!