switch to new sketch mode api (#2295)
* swtch to new api Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix ts Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * small changes 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>
@ -10,7 +10,7 @@
 | 
			
		||||
    "@fortawesome/react-fontawesome": "^0.2.0",
 | 
			
		||||
    "@headlessui/react": "^1.7.19",
 | 
			
		||||
    "@headlessui/tailwindcss": "^0.2.0",
 | 
			
		||||
    "@kittycad/lib": "^0.0.58",
 | 
			
		||||
    "@kittycad/lib": "^0.0.60",
 | 
			
		||||
    "@lezer/javascript": "^1.4.9",
 | 
			
		||||
    "@open-rpc/client-js": "^1.8.1",
 | 
			
		||||
    "@react-hook/resize-observer": "^1.2.6",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										6
									
								
								src-tauri/Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						@ -2536,7 +2536,7 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "kcl-lib"
 | 
			
		||||
version = "0.1.53"
 | 
			
		||||
version = "0.1.54"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "anyhow",
 | 
			
		||||
 "approx",
 | 
			
		||||
@ -2595,9 +2595,9 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "kittycad"
 | 
			
		||||
version = "0.3.0"
 | 
			
		||||
version = "0.3.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "ddc922f0da3abc22661bf49423c9bfcc02ce6ae92dae007ede6990874789545b"
 | 
			
		||||
checksum = "2c6e12eb45fd9a28c8e99dbdef54556246b39acee14e4aa6f0fc43636caa62d9"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "anyhow",
 | 
			
		||||
 "async-trait",
 | 
			
		||||
 | 
			
		||||
@ -356,6 +356,7 @@ fn open_url_sync(app: &tauri::AppHandle, url: &url::Url) {
 | 
			
		||||
    let cloned_url = url.clone();
 | 
			
		||||
    let runner: tauri::async_runtime::JoinHandle<Result<ProjectState>> = tauri::async_runtime::spawn(async move {
 | 
			
		||||
        let url_str = cloned_url.path().to_string();
 | 
			
		||||
 | 
			
		||||
        log::debug!("Opening URL path : {}", url_str);
 | 
			
		||||
        let path = Path::new(url_str.as_str());
 | 
			
		||||
        ProjectState::new_from_path(path.to_path_buf()).await
 | 
			
		||||
 | 
			
		||||
@ -873,7 +873,7 @@ export const modelingMachine = createMachine(
 | 
			
		||||
            type: 'modeling_cmd_req',
 | 
			
		||||
            cmd_id: uuidv4(),
 | 
			
		||||
            cmd: {
 | 
			
		||||
              type: 'default_camera_disable_sketch_mode',
 | 
			
		||||
              type: 'sketch_mode_disable',
 | 
			
		||||
            },
 | 
			
		||||
          })
 | 
			
		||||
          .then(async () => {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								src/wasm-lib/Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						@ -1895,7 +1895,7 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "kcl-lib"
 | 
			
		||||
version = "0.1.53"
 | 
			
		||||
version = "0.1.54"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "anyhow",
 | 
			
		||||
 "approx 0.5.1",
 | 
			
		||||
@ -1964,9 +1964,9 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "kittycad"
 | 
			
		||||
version = "0.3.0"
 | 
			
		||||
version = "0.3.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "ddc922f0da3abc22661bf49423c9bfcc02ce6ae92dae007ede6990874789545b"
 | 
			
		||||
checksum = "2c6e12eb45fd9a28c8e99dbdef54556246b39acee14e4aa6f0fc43636caa62d9"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "anyhow",
 | 
			
		||||
 "async-trait",
 | 
			
		||||
@ -2003,9 +2003,9 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "kittycad-execution-plan"
 | 
			
		||||
version = "0.1.5"
 | 
			
		||||
version = "0.1.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "ae99665cd699f8800da8ea4b01889c0c9c61619d2a9dc62d1d5028f1b21110bd"
 | 
			
		||||
checksum = "0936396491f132c163e9411a3dd699e5b2daa49c19436691c5153f7ad2d4953d"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "bytes",
 | 
			
		||||
 "gltf-json",
 | 
			
		||||
@ -2048,9 +2048,9 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "kittycad-modeling-cmds"
 | 
			
		||||
version = "0.2.22"
 | 
			
		||||
version = "0.2.23"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "ef6326553271cfb08d0143d9329f38cde162d5a0dcba1bd717c763d5361700d7"
 | 
			
		||||
checksum = "1c1f8bdab7f09b4f4a954dafe0694e96f6f2b73733cf7cddccc42ee493e2c1e9"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "anyhow",
 | 
			
		||||
 "chrono",
 | 
			
		||||
 | 
			
		||||
@ -62,11 +62,11 @@ members = [
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[workspace.dependencies]
 | 
			
		||||
kittycad = { version = "0.3.0", default-features = false, features = ["js", "requests"] }
 | 
			
		||||
kittycad-execution-plan = "0.1.5"
 | 
			
		||||
kittycad = { version = "0.3.1", default-features = false, features = ["js", "requests"] }
 | 
			
		||||
kittycad-execution-plan = "0.1.6"
 | 
			
		||||
kittycad-execution-plan-macros = "0.1.9"
 | 
			
		||||
kittycad-execution-plan-traits = "0.1.14"
 | 
			
		||||
kittycad-modeling-cmds = "0.2.22"
 | 
			
		||||
kittycad-modeling-cmds = "0.2.23"
 | 
			
		||||
kittycad-modeling-session = "0.1.4"
 | 
			
		||||
 | 
			
		||||
[[test]]
 | 
			
		||||
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 80 KiB  | 
| 
		 Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 82 KiB  | 
| 
		 Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 79 KiB  | 
@ -642,14 +642,15 @@ impl Callable for StartSketchAt {
 | 
			
		||||
        // Next, enter sketch mode.
 | 
			
		||||
        stack_api_call(
 | 
			
		||||
            &mut instructions,
 | 
			
		||||
            ModelingCmdEndpoint::SketchModeEnable,
 | 
			
		||||
            ModelingCmdEndpoint::EnableSketchMode,
 | 
			
		||||
            None,
 | 
			
		||||
            Uuid::new_v4().into(),
 | 
			
		||||
            [
 | 
			
		||||
                Some(axes.z).into_parts(),
 | 
			
		||||
                vec![false.into()], // animated
 | 
			
		||||
                vec![false.into()], // ortho mode
 | 
			
		||||
                vec![plane_id.into()],
 | 
			
		||||
                vec![false.into()],    // adjust camera
 | 
			
		||||
                vec![false.into()],    // animated
 | 
			
		||||
                vec![false.into()],    // ortho mode
 | 
			
		||||
                vec![plane_id.into()], // entity id (plane in this case)
 | 
			
		||||
            ],
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
[package]
 | 
			
		||||
name = "kcl-lib"
 | 
			
		||||
description = "KittyCAD Language implementation and tools"
 | 
			
		||||
version = "0.1.53"
 | 
			
		||||
version = "0.1.54"
 | 
			
		||||
edition = "2021"
 | 
			
		||||
license = "MIT"
 | 
			
		||||
repository = "https://github.com/KittyCAD/modeling-app"
 | 
			
		||||
 | 
			
		||||
@ -947,6 +947,7 @@ async fn start_sketch_on_face(
 | 
			
		||||
            ortho: false,
 | 
			
		||||
            entity_id: extrude_plane_id,
 | 
			
		||||
            adjust_camera: false,
 | 
			
		||||
            planar_normal: None,
 | 
			
		||||
        },
 | 
			
		||||
    )
 | 
			
		||||
    .await?;
 | 
			
		||||
@ -1005,12 +1006,13 @@ async fn start_sketch_on_plane(data: PlaneData, args: Args) -> Result<Box<Plane>
 | 
			
		||||
    // Enter sketch mode on the plane.
 | 
			
		||||
    args.send_modeling_cmd(
 | 
			
		||||
        uuid::Uuid::new_v4(),
 | 
			
		||||
        ModelingCmd::SketchModeEnable {
 | 
			
		||||
        ModelingCmd::EnableSketchMode {
 | 
			
		||||
            animated: false,
 | 
			
		||||
            ortho: false,
 | 
			
		||||
            plane_id: plane.id,
 | 
			
		||||
            entity_id: plane.id,
 | 
			
		||||
            // We pass in the normal for the plane here.
 | 
			
		||||
            disable_camera_with_plane: Some(plane.z_axis.clone().into()),
 | 
			
		||||
            planar_normal: Some(plane.z_axis.clone().into()),
 | 
			
		||||
            adjust_camera: false,
 | 
			
		||||
        },
 | 
			
		||||
    )
 | 
			
		||||
    .await?;
 | 
			
		||||
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 138 KiB  | 
| 
		 Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 108 KiB  | 
| 
		 Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 104 KiB  | 
| 
		 Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 104 KiB  | 
| 
		 Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 104 KiB  | 
@ -67,11 +67,12 @@ async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, uuid
 | 
			
		||||
        .send_modeling_cmd(
 | 
			
		||||
            uuid::Uuid::new_v4(),
 | 
			
		||||
            SourceRange::default(),
 | 
			
		||||
            ModelingCmd::SketchModeEnable {
 | 
			
		||||
            ModelingCmd::EnableSketchMode {
 | 
			
		||||
                animated: false,
 | 
			
		||||
                ortho: true,
 | 
			
		||||
                plane_id,
 | 
			
		||||
                disable_camera_with_plane: Some(Point3D { x: 0.0, y: 0.0, z: 1.0 }),
 | 
			
		||||
                entity_id: plane_id,
 | 
			
		||||
                planar_normal: Some(Point3D { x: 0.0, y: 0.0, z: 1.0 }),
 | 
			
		||||
                adjust_camera: false,
 | 
			
		||||
            },
 | 
			
		||||
        )
 | 
			
		||||
        .await?;
 | 
			
		||||
 | 
			
		||||
@ -1831,10 +1831,10 @@
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60"
 | 
			
		||||
  integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==
 | 
			
		||||
 | 
			
		||||
"@kittycad/lib@^0.0.58":
 | 
			
		||||
  version "0.0.58"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.58.tgz#4b47a295d8238e64d30d855336e4bcc4aab380f9"
 | 
			
		||||
  integrity sha512-iSkJNXumtlEjey/K1Lsl/j1aVlcjcPONW7+6YwqccioKJ6zwSCgXF4AFB3oxVmM27Gm8YjEmaHxbcOhGP02X9g==
 | 
			
		||||
"@kittycad/lib@^0.0.60":
 | 
			
		||||
  version "0.0.60"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.60.tgz#478aa1f750ab05cd4e67503de96f2f3bbc075329"
 | 
			
		||||
  integrity sha512-LW9NFy2gv0pm1GJyquMXPiFKOBSdJJxYGkmacDton6jluGhAa8Qtcuj3O5vqUEeq9ObSM1Jt8gp39P9nvXG9yg==
 | 
			
		||||
  dependencies:
 | 
			
		||||
    node-fetch "3.3.2"
 | 
			
		||||
    openapi-types "^12.0.0"
 | 
			
		||||
 | 
			
		||||