Skip to content

Commit

Permalink
Merge branch 'main' into kurt-selections-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Irev-Dev authored Mar 8, 2024
2 parents 8fc822a + 77e9a35 commit c835b51
Show file tree
Hide file tree
Showing 23 changed files with 710 additions and 1,419 deletions.
1,240 changes: 265 additions & 975 deletions docs/kcl/std.json

Large diffs are not rendered by default.

380 changes: 127 additions & 253 deletions docs/kcl/std.md

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kittycad = "0.2.59"
oauth2 = "4.4.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tauri = { version = "1.6.0", features = [ "os-all", "dialog-all", "fs-all", "http-request", "path-all", "shell-open", "shell-open-api", "devtools"] }
tauri = { version = "1.6.1", features = [ "os-all", "dialog-all", "fs-all", "http-request", "path-all", "shell-open", "shell-open-api", "devtools"] }
tauri-plugin-fs-extra = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tokio = { version = "1.36.0", features = ["time"] }
toml = "0.8.2"
Expand Down
18 changes: 13 additions & 5 deletions src/clientSideScene/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ export class CameraControls {

async tweenCameraToQuaternion(
targetQuaternion: Quaternion,
targetPosition = new Vector3(),
duration = 500,
toOrthographic = true
): Promise<void> {
Expand All @@ -750,43 +751,50 @@ export class CameraControls {
}
await this._tweenCameraToQuaternion(
targetQuaternion,
targetPosition,
remainingDuration,
toOrthographic
)
}
_tweenCameraToQuaternion(
targetQuaternion: Quaternion,
targetPosition: Vector3,
duration = 500,
toOrthographic = false
): Promise<void> {
return new Promise((resolve) => {
const camera = this.camera
this._isCamMovingCallback(true, true)
const initialQuaternion = camera.quaternion.clone()
const initialTarget = this.target.clone()
const isVertical = isQuaternionVertical(targetQuaternion)
let tweenEnd = isVertical ? 0.99 : 1
const controlsTarget = this.target.clone()
const initialDistance = controlsTarget.distanceTo(camera.position.clone())
const tempVec = new Vector3()
const initialDistance = initialTarget.distanceTo(camera.position.clone())

const cameraAtTime = (animationProgress: number /* 0 - 1 */) => {
const currentQ = tempQuaternion.slerpQuaternions(
initialQuaternion,
targetQuaternion,
animationProgress
)
const currentTarget = tempVec.lerpVectors(
initialTarget,
targetPosition,
animationProgress
)
if (this.camera instanceof PerspectiveCamera)
// changing the camera position back when it's orthographic doesn't do anything
// and it messes up animating back to perspective later
this.camera.position
.set(0, 0, 1)
.applyQuaternion(currentQ)
.multiplyScalar(initialDistance)
.add(controlsTarget)
.add(currentTarget)

this.camera.up.set(0, 1, 0).applyQuaternion(currentQ).normalize()
this.camera.quaternion.copy(currentQ)
this.target.copy(controlsTarget)
// this.controls.update()
this.target.copy(currentTarget)
this.camera.updateProjectionMatrix()
this.update()
this.onCameraChange()
Expand Down
30 changes: 15 additions & 15 deletions src/wasm-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/wasm-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ wasm-bindgen-futures = { version = "0.4.41", features = ["futures-core-03-stream
wasm-streams = "0.4.0"

[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
version = "0.3.68"
version = "0.3.69"
features = [
"console",
"HtmlTextAreaElement",
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-lib/derive-docs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "derive-docs"
description = "A tool for generating documentation from Rust derive macros"
version = "0.1.8"
version = "0.1.9"
edition = "2021"
license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app"
Expand Down
3 changes: 2 additions & 1 deletion src/wasm-lib/derive-docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ fn do_stdlib_inner(
let (ty_string, ty_ident) = clean_ty_string(ty.to_string().as_str());

let ty_string = rust_type_to_openapi_type(&ty_string);
let required = !ty_ident.to_string().starts_with("Option <");

if ty_string != "Args" {
let schema = if ty_ident.to_string().starts_with("Vec < ")
Expand All @@ -216,7 +217,7 @@ fn do_stdlib_inner(
name: #arg_name.to_string(),
type_: #ty_string.to_string(),
schema: #schema,
required: true,
required: #required,
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-lib/derive-docs/tests/option.gen
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl crate::docs::StdLibFn for Show {
name: "args".to_string(),
type_: "number".to_string(),
schema: <Option<f64>>::json_schema(&mut generator),
required: true,
required: false,
}]
}

Expand Down
2 changes: 1 addition & 1 deletion src/wasm-lib/derive-docs/tests/option_input_format.gen
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl crate::docs::StdLibFn for Import {
name: "args".to_string(),
type_: "kittycad::types::InputFormat".to_string(),
schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator),
required: true,
required: false,
}]
}

Expand Down
8 changes: 4 additions & 4 deletions src/wasm-lib/kcl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "kcl-lib"
description = "KittyCAD Language implementation and tools"
version = "0.1.42"
version = "0.1.44"
edition = "2021"
license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app"
Expand All @@ -17,7 +17,7 @@ async-trait = "0.1.77"
clap = { version = "4.5.1", features = ["cargo", "derive", "env", "unicode"], optional = true }
dashmap = "5.5.3"
databake = { version = "0.1.7", features = ["derive"] }
derive-docs = { version = "0.1.8" }
derive-docs = { version = "0.1.9" }
#derive-docs = { path = "../derive-docs" }
futures = { version = "0.3.30" }
gltf-json = "1.4.0"
Expand All @@ -41,7 +41,7 @@ js-sys = { version = "0.3.69" }
tower-lsp = { version = "0.20.0", default-features = false, features = ["runtime-agnostic"] }
wasm-bindgen = "0.2.91"
wasm-bindgen-futures = "0.4.41"
web-sys = { version = "0.3.68", features = ["console"] }
web-sys = { version = "0.3.69", features = ["console"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
approx = "0.5"
Expand All @@ -65,7 +65,7 @@ debug = true # Flamegraphs of benchmarks require accurate debug symbols
[dev-dependencies]
criterion = "0.5.1"
expectorate = "1.1.0"
insta = { version = "1.34.0", features = ["json"] }
insta = { version = "1.36.1", features = ["json"] }
itertools = "0.12.1"
pretty_assertions = "1.4.0"
tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros", "time"] }
Expand Down
Loading

0 comments on commit c835b51

Please sign in to comment.