roipoussiere / cadquery-server

A web server used to render 3d models from CadQuery code loaded dynamically.
MIT License
54 stars 17 forks source link

do not reset the camera on update #37

Closed roipoussiere closed 2 years ago

bernhard-42 commented 2 years ago

You could try something like

function update_size_options() {
    options.height = window.innerHeight - 44;
    options.treeWidth = window.innerWidth > 400 ? window.innerWidth / 3 : 200;
    options.cadWidth = window.innerWidth - (options.glass ? 8 : options.treeWidth + 10);
    if (viewer != null) {
        options.position = viewer.getCameraPosition();
        options.quaternion = viewer.getCameraQuaternion();
        options.target = viewer.getCameraTarget();
        options.zoom = viewer.getCameraZoom();
    }
}
roipoussiere commented 2 years ago

Works like a charm, thank you!

fixed in 937d4ff

bullestock commented 1 year ago

This does not appear to work in 0.4.1 - when I modify the file in an external editor, cadquery-server reloads the file and resets the view to default.

In addition to the view being reset, any checkmarks in 'Axes' etc are also cleared.