Handle relative paths at kcl level (#506)
* handle relative paths at kcl level * fmt * update kittycad Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * bump Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@headlessui/react": "^1.7.13",
|
||||
"@headlessui/tailwindcss": "^0.2.0",
|
||||
"@kittycad/lib": "^0.0.37",
|
||||
"@kittycad/lib": "^0.0.38",
|
||||
"@lezer/javascript": "^1.4.7",
|
||||
"@open-rpc/client-js": "^1.8.1",
|
||||
"@react-hook/resize-observer": "^1.2.6",
|
||||
|
28
src/wasm-lib/Cargo.lock
generated
28
src/wasm-lib/Cargo.lock
generated
@ -226,6 +226,20 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bigdecimal"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "454bca3db10617b88b566f205ed190aedb0e0e6dd4cad61d3988a72e8c5594cb"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
@ -1397,13 +1411,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kittycad"
|
||||
version = "0.2.25"
|
||||
version = "0.2.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9cf962b1e81a0b4eb923a727e761b40672cbacc7f5f0b75e13579d346352bc7"
|
||||
checksum = "e2623ee601ce203476229df3f9d3a14664cb43e3f7455e9ac8ed91aacaa6163d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"base64 0.21.4",
|
||||
"bigdecimal 0.4.1",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"data-encoding",
|
||||
@ -1465,6 +1480,12 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.6"
|
||||
@ -2429,7 +2450,8 @@ version = "0.8.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c"
|
||||
dependencies = [
|
||||
"bigdecimal",
|
||||
"bigdecimal 0.3.1",
|
||||
"bigdecimal 0.4.1",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"dyn-clone",
|
||||
|
@ -67,6 +67,7 @@ fn inner_line_to(
|
||||
y: to[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative: false,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
@ -201,6 +202,7 @@ fn inner_line(data: LineData, sketch_group: Box<SketchGroup>, args: &mut Args) -
|
||||
LineData::Point(to) => *to,
|
||||
};
|
||||
|
||||
let delta = inner_args;
|
||||
let to = [from.x + inner_args[0], from.y + inner_args[1]];
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
@ -211,10 +213,11 @@ fn inner_line(data: LineData, sketch_group: Box<SketchGroup>, args: &mut Args) -
|
||||
path: sketch_group.id,
|
||||
segment: kittycad::types::PathSegment::Line {
|
||||
end: Point3D {
|
||||
x: to[0],
|
||||
y: to[1],
|
||||
x: delta[0],
|
||||
y: delta[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative: true,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
@ -349,10 +352,15 @@ fn inner_angled_line(
|
||||
AngledLineData::AngleWithTag { angle, length, .. } => (*angle, *length),
|
||||
AngledLineData::AngleAndLength(angle_and_length) => (angle_and_length[0], angle_and_length[1]),
|
||||
};
|
||||
let to: [f64; 2] = [
|
||||
from.x + length * f64::cos(angle.to_radians()),
|
||||
from.y + length * f64::sin(angle.to_radians()),
|
||||
|
||||
//double check me on this one - mike
|
||||
let delta: [f64; 2] = [
|
||||
length * f64::cos(angle.to_radians()),
|
||||
length * f64::sin(angle.to_radians()),
|
||||
];
|
||||
let relative = true;
|
||||
|
||||
let to: [f64; 2] = [from.x + delta[0], from.y + delta[1]];
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
|
||||
@ -378,10 +386,11 @@ fn inner_angled_line(
|
||||
path: sketch_group.id,
|
||||
segment: kittycad::types::PathSegment::Line {
|
||||
end: Point3D {
|
||||
x: to[0],
|
||||
y: to[1],
|
||||
x: delta[0],
|
||||
y: delta[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
@ -832,9 +841,14 @@ fn inner_arc(data: ArcData, sketch_group: Box<SketchGroup>, args: &mut Args) ->
|
||||
angle_end: angle_end.degrees(),
|
||||
center: center.into(),
|
||||
radius,
|
||||
relative: false,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
|
||||
// TODO: Dont do this (move path pen) - mike
|
||||
// lets review what the needs are here and see if any existing arc endpoints can accomplish this
|
||||
|
||||
// Move the path pen to the end of the arc.
|
||||
// Since that is where we want to draw the next path.
|
||||
// TODO: the engine should automatically move the pen to the end of the arc.
|
||||
@ -927,6 +941,8 @@ fn inner_bezier_curve(
|
||||
BezierData::Points { to, control1, control2 } => (to, control1, control2),
|
||||
};
|
||||
|
||||
let relative = true;
|
||||
let delta = to;
|
||||
let to = [from.x + to[0], from.y + to[1]];
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
@ -937,20 +953,21 @@ fn inner_bezier_curve(
|
||||
path: sketch_group.id,
|
||||
segment: kittycad::types::PathSegment::Bezier {
|
||||
control1: Point3D {
|
||||
x: from.x + control1[0],
|
||||
y: from.y + control1[1],
|
||||
x: control1[0],
|
||||
y: control1[1],
|
||||
z: 0.0,
|
||||
},
|
||||
control2: Point3D {
|
||||
x: from.x + control2[0],
|
||||
y: from.y + control2[1],
|
||||
x: control2[0],
|
||||
y: control2[1],
|
||||
z: 0.0,
|
||||
},
|
||||
end: Point3D {
|
||||
x: to[0],
|
||||
y: to[1],
|
||||
x: delta[0],
|
||||
y: delta[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 74 KiB |
@ -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.37":
|
||||
version "0.0.37"
|
||||
resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.37.tgz#ec4f6c4fb5d06402a19339f3374036b6582d2265"
|
||||
integrity sha512-P8p9FeLV79/0Lfd0RioBta1drzhmpROnU4YV38+zsAA4LhibQCTjeekRkxVvHztGumPxz9pPsAeeLJyuz2RWKQ==
|
||||
"@kittycad/lib@^0.0.38":
|
||||
version "0.0.38"
|
||||
resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.38.tgz#50474266f679990bd414c30f884f2d42a0d5dba9"
|
||||
integrity sha512-Lv9P7jqVRoGgOnCsRCsG8OwZH5n3scxXYrElR+5/Rsd6/KIarLB4bSBngJrXebOnmTw5md0OPeY+b3ZDbZFDeg==
|
||||
dependencies:
|
||||
node-fetch "3.3.2"
|
||||
openapi-types "^12.0.0"
|
||||
|
Reference in New Issue
Block a user