Control the camera position
It would be nice to offer an API for the camera. An app using the library could offer some controls, for example
- to zoom on a specific segment
- to have a top/front/side view
- reset the initial view
I don't have a particular design in mind, but it would be nice to have a layer of abstraction over three.js that hides the complexity of calculating position relative to the build volume and part dimensions.
maybe we can add these buttons for restoring the camera position in this change? https://github.com/remcoder/gcode-preview/pull/139/commits/d44c38efa58576152bdfdf9510ffbfaff7aaa57a
Yes!
load/save/clear camera position was added in e55f57021c08ad1a38b973163c6e692e8b939ad0 (sorry should've been PR 😅)
These are just dev helpers for now.
The way it works is: the position, rotation and zoom of the camera and the target it is looking at are stored in localStorage. When the page loads, we check if there are stored settings and if so we apply them.
This super useful when you're debugging/developing something visually! 😄