gcode-preview icon indicating copy to clipboard operation
gcode-preview copied to clipboard

Control the camera position

Open sophiedeziel opened this issue 1 year ago • 3 comments

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.

sophiedeziel avatar May 24 '24 01:05 sophiedeziel

maybe we can add these buttons for restoring the camera position in this change? https://github.com/remcoder/gcode-preview/pull/139/commits/d44c38efa58576152bdfdf9510ffbfaff7aaa57a

remcoder avatar May 29 '24 06:05 remcoder

Yes!

sophiedeziel avatar May 30 '24 04:05 sophiedeziel

load/save/clear camera position was added in e55f57021c08ad1a38b973163c6e692e8b939ad0 (sorry should've been PR 😅)

Image

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! 😄

remcoder avatar Jun 25 '25 09:06 remcoder