diff --git a/package.json b/package.json index fe2e44352..5ed3917d6 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@headlessui/react": "^1.7.13", "@headlessui/tailwindcss": "^0.2.0", - "@kittycad/lib": "^0.0.42", + "@kittycad/lib": "^0.0.43", "@lezer/javascript": "^1.4.7", "@open-rpc/client-js": "^1.8.1", "@react-hook/resize-observer": "^1.2.6", diff --git a/src/hooks/useAppMode.ts b/src/hooks/useAppMode.ts index a60c3afc2..f9916195e 100644 --- a/src/hooks/useAppMode.ts +++ b/src/hooks/useAppMode.ts @@ -236,10 +236,12 @@ async function createPlane( x_axis, y_axis, color, + hidden, }: { x_axis: Models['Point3d_type'] y_axis: Models['Point3d_type'] color: Models['Color_type'] + hidden: boolean } ) { const planeId = uuidv4() @@ -252,6 +254,7 @@ async function createPlane( x_axis, y_axis, clobber: false, + hide: hidden, }, cmd_id: planeId, }) @@ -304,6 +307,7 @@ export async function initDefaultPlanes( x_axis: { x: 1, y: 0, z: 0 }, y_axis: { x: 0, y: 1, z: 0 }, color: { r: 0.7, g: 0.28, b: 0.28, a: 0.4 }, + hidden: hidePlanes ? true : false, }) if (hidePlanes) { hidePlane(engineCommandManager, xy, true) @@ -312,6 +316,7 @@ export async function initDefaultPlanes( x_axis: { x: 0, y: 1, z: 0 }, y_axis: { x: 0, y: 0, z: 1 }, color: { r: 0.28, g: 0.7, b: 0.28, a: 0.4 }, + hidden: hidePlanes ? true : false, }) if (hidePlanes) { hidePlane(engineCommandManager, yz, true) @@ -320,10 +325,8 @@ export async function initDefaultPlanes( x_axis: { x: 1, y: 0, z: 0 }, y_axis: { x: 0, y: 0, z: 1 }, color: { r: 0.28, g: 0.28, b: 0.7, a: 0.4 }, + hidden: hidePlanes ? true : false, }) - if (hidePlanes) { - hidePlane(engineCommandManager, xz, true) - } return { xy, yz, xz } } diff --git a/src/wasm-lib/Cargo.lock b/src/wasm-lib/Cargo.lock index 295a7d143..eec03a00a 100644 --- a/src/wasm-lib/Cargo.lock +++ b/src/wasm-lib/Cargo.lock @@ -1426,9 +1426,9 @@ dependencies = [ [[package]] name = "kittycad" -version = "0.2.29" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4efcb5ca8f8581383b0969344d5096f1613f28e0b11abc7a77bd0abb17d656a5" +checksum = "539b323537b877fc8dd130362b8f1af9af8051c19208bb8bfd816ab7c330f2bb" dependencies = [ "anyhow", "async-trait", diff --git a/src/wasm-lib/Cargo.toml b/src/wasm-lib/Cargo.toml index 2873881d5..7ba0d9e3c 100644 --- a/src/wasm-lib/Cargo.toml +++ b/src/wasm-lib/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib"] bson = { version = "2.7.0", features = ["uuid-1", "chrono"] } gloo-utils = "0.2.0" kcl-lib = { path = "kcl" } -kittycad = { version = "0.2.29", default-features = false, features = ["js"] } +kittycad = { version = "0.2.31", default-features = false, features = ["js"] } serde_json = "1.0.107" uuid = { version = "1.4.1", features = ["v4", "js", "serde"] } wasm-bindgen = "0.2.87" @@ -20,7 +20,7 @@ wasm-bindgen-futures = "0.4.37" [dev-dependencies] anyhow = "1" image = "0.24.7" -kittycad = "0.2.29" +kittycad = "0.2.31" pretty_assertions = "1.4.0" reqwest = { version = "0.11.22", default-features = false } tokio = { version = "1.32.0", features = ["rt-multi-thread", "macros", "time"] } diff --git a/src/wasm-lib/kcl/Cargo.toml b/src/wasm-lib/kcl/Cargo.toml index 874629a7d..2068ff1dd 100644 --- a/src/wasm-lib/kcl/Cargo.toml +++ b/src/wasm-lib/kcl/Cargo.toml @@ -15,7 +15,7 @@ clap = { version = "4.4.6", features = ["cargo", "derive", "env", "unicode"], op dashmap = "5.5.3" derive-docs = { version = "0.1.4" } #derive-docs = { path = "../derive-docs" } -kittycad = { version = "0.2.29", default-features = false, features = ["js"] } +kittycad = { version = "0.2.31", default-features = false, features = ["js"] } lazy_static = "1.4.0" parse-display = "0.8.2" schemars = { version = "0.8", features = ["impl_json_schema", "url", "uuid1"] } diff --git a/src/wasm-lib/kcl/src/executor.rs b/src/wasm-lib/kcl/src/executor.rs index 20929a3d7..d24973f27 100644 --- a/src/wasm-lib/kcl/src/executor.rs +++ b/src/wasm-lib/kcl/src/executor.rs @@ -187,6 +187,7 @@ impl DefaultPlanes { size: default_size, x_axis: Point3D { x: 1.0, y: 0.0, z: 0.0 }, y_axis: Point3D { x: 0.0, y: 1.0, z: 0.0 }, + hide: Some(true), }, ) .await?; @@ -206,17 +207,6 @@ impl DefaultPlanes { }, ) .await?; - // Set it as hidden. - engine - .send_modeling_cmd( - uuid::Uuid::new_v4(), - SourceRange::default(), - ModelingCmd::ObjectVisible { - hidden: true, - object_id: xy, - }, - ) - .await?; // Create yz plane. let yz = uuid::Uuid::new_v4(); @@ -230,6 +220,7 @@ impl DefaultPlanes { size: default_size, x_axis: Point3D { x: 0.0, y: 1.0, z: 0.0 }, y_axis: Point3D { x: 0.0, y: 0.0, z: 1.0 }, + hide: Some(true), }, ) .await?; @@ -249,17 +240,6 @@ impl DefaultPlanes { }, ) .await?; - // Set it as hidden. - engine - .send_modeling_cmd( - uuid::Uuid::new_v4(), - SourceRange::default(), - ModelingCmd::ObjectVisible { - hidden: true, - object_id: yz, - }, - ) - .await?; // Create xz plane. let xz = uuid::Uuid::new_v4(); @@ -273,6 +253,7 @@ impl DefaultPlanes { size: default_size, x_axis: Point3D { x: 1.0, y: 0.0, z: 0.0 }, y_axis: Point3D { x: 0.0, y: 0.0, z: 1.0 }, + hide: Some(true), }, ) .await?; @@ -292,17 +273,6 @@ impl DefaultPlanes { }, ) .await?; - // Set it as hidden. - engine - .send_modeling_cmd( - uuid::Uuid::new_v4(), - SourceRange::default(), - ModelingCmd::ObjectVisible { - hidden: true, - object_id: xz, - }, - ) - .await?; Ok(Self { xy, xz, yz }) } diff --git a/src/wasm-lib/kcl/src/std/sketch.rs b/src/wasm-lib/kcl/src/std/sketch.rs index bb816b21f..0e424854f 100644 --- a/src/wasm-lib/kcl/src/std/sketch.rs +++ b/src/wasm-lib/kcl/src/std/sketch.rs @@ -810,6 +810,7 @@ async fn inner_start_sketch_on(data: PlaneData, args: Args) -> Result size: 60.0, x_axis: (*x_axis).into(), y_axis: (*y_axis).into(), + hide: Some(true), }, ) .await?; diff --git a/src/wasm-lib/tests/modify/main.rs b/src/wasm-lib/tests/modify/main.rs index b67e59e4c..b9b8a6f16 100644 --- a/src/wasm-lib/tests/modify/main.rs +++ b/src/wasm-lib/tests/modify/main.rs @@ -60,6 +60,7 @@ async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, uuid size: 60.0, x_axis: Point3D { x: 1.0, y: 0.0, z: 0.0 }, y_axis: Point3D { x: 0.0, y: 1.0, z: 0.0 }, + hide: Some(true), }, ) .await?; diff --git a/yarn.lock b/yarn.lock index 53584b0b4..ad4545935 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1530,10 +1530,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.42": - version "0.0.42" - resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.42.tgz#7d12a6f90cfbaf4e25a9ffaa67869d95dc046a67" - integrity sha512-9wJSvUdFs7NnvVfYAIvEcJVZrlEF8AS+l6oAmquxOq04pbXcrSGzs/wc1yXgjYJNFAGIiL3ahgolNUzAJ+KGrA== +"@kittycad/lib@^0.0.43": + version "0.0.43" + resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.43.tgz#b93c0961200cf327f5ac6491be1ca01f9edc321c" + integrity sha512-Pe/PQfZ8BWEDOm4dkY4tcPcuCSh2mQPe/W8RvJ6PQNTlB7bmjAj0234pVyG+8zrKKsJC9nq4ye7CZoaXEfUSTg== dependencies: node-fetch "3.3.2" openapi-types "^12.0.0"