Zoom to fit rust side (#2195)

* zoom to fit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* zoom to fit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-04-22 17:14:10 -07:00
committed by GitHub
parent c461db5f54
commit c01084feb0
215 changed files with 118 additions and 384 deletions

View File

@ -42,17 +42,14 @@ async fn execute_and_snapshot(code: &str, units: kittycad::types::UnitLength) ->
let _ = ctx.run(program, None).await?;
let (x, y) = kcl_lib::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
// Zoom to fit.
ctx.engine
.send_modeling_cmd(
uuid::Uuid::new_v4(),
kcl_lib::executor::SourceRange::default(),
kittycad::types::ModelingCmd::DefaultCameraLookAt {
center: kittycad::types::Point3D { x: 0.0, y: 0.0, z: 0.0 },
up: kittycad::types::Point3D { x: 0.0, y: 0.0, z: 1.0 },
vantage: kittycad::types::Point3D { x: 0.0, y: -x, z: y },
sequence: None,
kittycad::types::ModelingCmd::ZoomToFit {
object_ids: Some(Default::default()),
padding: 0.1,
},
)
.await?;