Update dependencies and lock files (#1841)

* Bump lock files

* Fix glam mismatch version

* Add tokio feature

* Update all deps

* Fix gpu-compiler not able to reference the root workspace

* Bump a few more deps

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
James Lindsay
2024-07-22 02:56:29 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent ab71d26d84
commit fa1535d0bb
31 changed files with 7466 additions and 8962 deletions
Generated
+190 -192
View File
File diff suppressed because it is too large Load Diff
+7 -8
View File
@@ -55,8 +55,8 @@ axum = "0.7"
chrono = "0.4" chrono = "0.4"
ron = "0.8" ron = "0.8"
fastnoise-lite = "1.1" fastnoise-lite = "1.1"
spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu.git" } spirv-std = { git = "https://github.com/GraphiteEditor/rust-gpu.git" }
wgpu-types = "0.17" wgpu-types = "0.20"
wgpu = { version = "0.20", features = ["strict_asserts", "api_log_info"] } wgpu = { version = "0.20", features = ["strict_asserts", "api_log_info"] }
once_cell = "1.13" # Remove when `core::cell::LazyCell` (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>) is stabilized in Rust 1.80 and we bump our MSRV once_cell = "1.13" # Remove when `core::cell::LazyCell` (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>) is stabilized in Rust 1.80 and we bump our MSRV
wasm-bindgen = "=0.2.92" # NOTICE: ensure this stays in sync with the `wasm-bindgen-cli` version in `website/content/volunteer/guide/getting-started/_index.md`. We pin this version because wasm-bindgen upgrades may break various things. wasm-bindgen = "=0.2.92" # NOTICE: ensure this stays in sync with the `wasm-bindgen-cli` version in `website/content/volunteer/guide/getting-started/_index.md`. We pin this version because wasm-bindgen upgrades may break various things.
@@ -67,11 +67,11 @@ winit = "0.29"
url = "2.5" url = "2.5"
tokio = { version = "1.29", features = ["fs", "io-std"] } tokio = { version = "1.29", features = ["fs", "io-std"] }
vello = "0.2" vello = "0.2"
resvg = "0.41" resvg = "0.42"
usvg = "0.41" usvg = "0.42"
rand = { version = "0.8", default-features = false } rand = { version = "0.8", default-features = false }
rand_chacha = "0.3" rand_chacha = "0.3"
glam = { version = "0.25", default-features = false, features = ["serde"] } glam = { version = "0.28", default-features = false, features = ["serde"] }
base64 = "0.22" base64 = "0.22"
image = { version = "0.25", default-features = false, features = ["png"] } image = { version = "0.25", default-features = false, features = ["png"] }
rustybuzz = "0.17" rustybuzz = "0.17"
@@ -83,15 +83,14 @@ num-derive = "0.4"
num-traits = { version = "0.2", default-features = false, features = ["i128"] } num-traits = { version = "0.2", default-features = false, features = ["i128"] }
specta = { git = "https://github.com/oscartbeaumont/specta.git", features = [ specta = { git = "https://github.com/oscartbeaumont/specta.git", features = [
"glam", "glam",
"derive",
# "typescript", # "typescript",
] } ] }
syn = { version = "2.0", default-features = false, features = [ syn = { version = "2.0", default-features = false, features = [
"full", "full",
"derive", "derive",
] } ] }
kurbo = { version = "0.11.0", features = [ kurbo = { version = "0.11.0", features = ["serde"] }
"serde",
] }
[profile.dev] [profile.dev]
opt-level = 1 opt-level = 1
@@ -569,8 +569,7 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
parent, parent,
insert_index, insert_index,
} => { } => {
let database = usvg::fontdb::Database::new(); let tree = match usvg::Tree::from_str(&svg, &usvg::Options::default()) {
let tree = match usvg::Tree::from_str(&svg, &usvg::Options::default(), &database) {
Ok(t) => t, Ok(t) => t,
Err(e) => { Err(e) => {
responses.add(DocumentMessage::DocumentHistoryBackward); responses.add(DocumentMessage::DocumentHistoryBackward);
@@ -304,7 +304,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageData<'_>> for Navigation
let half_viewport = ipp.viewport_bounds.size() / 2.; let half_viewport = ipp.viewport_bounds.size() / 2.;
let start_offset = self.mouse_position - half_viewport; let start_offset = self.mouse_position - half_viewport;
let end_offset = ipp.mouse.position - half_viewport; let end_offset = ipp.mouse.position - half_viewport;
let angle = start_offset.angle_between(end_offset); let angle = start_offset.angle_to(end_offset);
tilt_raw_not_snapped + angle tilt_raw_not_snapped + angle
}; };
@@ -435,7 +435,7 @@ pub fn are_manipulator_handles_colinear(group: &bezier_rs::ManipulatorGroup<Poin
let anchor_is_endpoint = !subpath.closed() && (index == 0 || index == subpath.len() - 1); let anchor_is_endpoint = !subpath.closed() && (index == 0 || index == subpath.len() - 1);
// Unless this is an endpoint, check if both handles are colinear (within an angular epsilon) // Unless this is an endpoint, check if both handles are colinear (within an angular epsilon)
!anchor_is_endpoint && handle_in.is_some_and(|handle_in| handle_out.is_some_and(|handle_out| handle_in.angle_between(handle_out) < 1e-5)) !anchor_is_endpoint && handle_in.is_some_and(|handle_in| handle_out.is_some_and(|handle_out| handle_in.angle_to(handle_out) < 1e-5))
} }
pub fn get_layer_snap_points(layer: LayerNodeIdentifier, snap_data: &SnapData, points: &mut Vec<SnapCandidatePoint>) { pub fn get_layer_snap_points(layer: LayerNodeIdentifier, snap_data: &SnapData, points: &mut Vec<SnapCandidatePoint>) {
@@ -204,7 +204,7 @@ pub fn axis_align_drag(axis_align: bool, position: DVec2, start: DVec2) -> DVec2
if axis_align { if axis_align {
let mouse_position = position - start; let mouse_position = position - start;
let snap_resolution = SELECTION_DRAG_ANGLE.to_radians(); let snap_resolution = SELECTION_DRAG_ANGLE.to_radians();
let angle = -mouse_position.angle_between(DVec2::X); let angle = -mouse_position.angle_to(DVec2::X);
let snapped_angle = (angle / snap_resolution).round() * snap_resolution; let snapped_angle = (angle / snap_resolution).round() * snap_resolution;
if snapped_angle.is_finite() { if snapped_angle.is_finite() {
start + DVec2::new(snapped_angle.cos(), snapped_angle.sin()) * mouse_position.length() start + DVec2::new(snapped_angle.cos(), snapped_angle.sin()) * mouse_position.length()
@@ -163,7 +163,7 @@ impl SelectedGradient {
let delta = point - mouse; let delta = point - mouse;
let length = delta.length(); let length = delta.length();
let mut angle = -delta.angle_between(DVec2::X); let mut angle = -delta.angle_to(DVec2::X);
let snap_resolution = LINE_ROTATE_SNAP_ANGLE.to_radians(); let snap_resolution = LINE_ROTATE_SNAP_ANGLE.to_radians();
angle = (angle / snap_resolution).round() * snap_resolution; angle = (angle / snap_resolution).round() * snap_resolution;
@@ -181,7 +181,7 @@ impl SelectedGradient {
let (start, end) = (self.transform.transform_point2(self.gradient.start), self.transform.transform_point2(self.gradient.end)); let (start, end) = (self.transform.transform_point2(self.gradient.start), self.transform.transform_point2(self.gradient.end));
// Calculate the new position by finding the closest point on the line // Calculate the new position by finding the closest point on the line
let new_pos = ((end - start).angle_between(mouse - start)).cos() * start.distance(mouse) / start.distance(end); let new_pos = ((end - start).angle_to(mouse - start)).cos() * start.distance(mouse) / start.distance(end);
// Should not go off end but can swap // Should not go off end but can swap
let clamped = new_pos.clamp(0., 1.); let clamped = new_pos.clamp(0., 1.);
@@ -332,7 +332,7 @@ impl Fsm for GradientToolFsmState {
let (start, end) = (transform.transform_point2(gradient.start), transform.transform_point2(gradient.end)); let (start, end) = (transform.transform_point2(gradient.start), transform.transform_point2(gradient.end));
// Compute the distance from the mouse to the gradient line in viewport space // Compute the distance from the mouse to the gradient line in viewport space
let distance = (end - start).angle_between(mouse - start).sin() * (mouse - start).length(); let distance = (end - start).angle_to(mouse - start).sin() * (mouse - start).length();
// If click is on the line then insert point // If click is on the line then insert point
if distance < (SELECTION_THRESHOLD * 2.) { if distance < (SELECTION_THRESHOLD * 2.) {
@@ -299,7 +299,7 @@ fn generate_transform(tool_data: &mut LineToolData, snap_data: SnapData, lock_an
let document_to_viewport = snap_data.document.metadata.document_to_viewport; let document_to_viewport = snap_data.document.metadata.document_to_viewport;
let mut document_points = [tool_data.drag_start, document_to_viewport.inverse().transform_point2(tool_data.drag_current)]; let mut document_points = [tool_data.drag_start, document_to_viewport.inverse().transform_point2(tool_data.drag_current)];
let mut angle = -(document_points[1] - document_points[0]).angle_between(DVec2::X); let mut angle = -(document_points[1] - document_points[0]).angle_to(DVec2::X);
let mut line_length = (document_points[1] - document_points[0]).length(); let mut line_length = (document_points[1] - document_points[0]).length();
if lock_angle { if lock_angle {
angle = tool_data.angle; angle = tool_data.angle;
@@ -352,11 +352,11 @@ fn generate_transform(tool_data: &mut LineToolData, snap_data: SnapData, lock_an
} }
// Used for keeping the same angle next frame // Used for keeping the same angle next frame
tool_data.angle = -(document_points[1] - document_points[0]).angle_between(DVec2::X); tool_data.angle = -(document_points[1] - document_points[0]).angle_to(DVec2::X);
let viewport_points = [document_to_viewport.transform_point2(document_points[0]), document_to_viewport.transform_point2(document_points[1])]; let viewport_points = [document_to_viewport.transform_point2(document_points[0]), document_to_viewport.transform_point2(document_points[1])];
let line_length = (viewport_points[1] - viewport_points[0]).length(); let line_length = (viewport_points[1] - viewport_points[0]).length();
let angle = -(viewport_points[1] - viewport_points[0]).angle_between(DVec2::X); let angle = -(viewport_points[1] - viewport_points[0]).angle_to(DVec2::X);
GraphOperationMessage::TransformSet { GraphOperationMessage::TransformSet {
layer: tool_data.layer.unwrap(), layer: tool_data.layer.unwrap(),
transform: glam::DAffine2::from_scale_angle_translation(DVec2::new(line_length, 1.), angle, viewport_points[0]), transform: glam::DAffine2::from_scale_angle_translation(DVec2::new(line_length, 1.), angle, viewport_points[0]),
@@ -362,7 +362,7 @@ impl PenToolData {
let angle = if lock_angle { let angle = if lock_angle {
self.angle self.angle
} else if (relative - document_pos) != DVec2::ZERO && !lock_angle { } else if (relative - document_pos) != DVec2::ZERO && !lock_angle {
(-(relative - document_pos).angle_between(DVec2::X) / resolution).round() * resolution (-(relative - document_pos).angle_to(DVec2::X) / resolution).round() * resolution
} else { } else {
self.angle self.angle
}; };
@@ -405,7 +405,7 @@ impl PenToolData {
if let Some(relative) = relative.map(|layer| transform.transform_point2(layer)) { if let Some(relative) = relative.map(|layer| transform.transform_point2(layer)) {
if (relative - document_pos) != DVec2::ZERO { if (relative - document_pos) != DVec2::ZERO {
self.angle = -(relative - document_pos).angle_between(DVec2::X) self.angle = -(relative - document_pos).angle_to(DVec2::X)
} }
} }
@@ -757,7 +757,7 @@ impl Fsm for SelectToolFsmState {
let start_offset = tool_data.drag_start - bounds.center_of_transformation; let start_offset = tool_data.drag_start - bounds.center_of_transformation;
let end_offset = input.mouse.position - bounds.center_of_transformation; let end_offset = input.mouse.position - bounds.center_of_transformation;
start_offset.angle_between(end_offset) start_offset.angle_to(end_offset)
}; };
let snapped_angle = if input.keyboard.key(modifier_keys.snap_angle) { let snapped_angle = if input.keyboard.key(modifier_keys.snap_angle) {
@@ -186,7 +186,7 @@ impl<'a> MessageHandler<TransformLayerMessage, TransformData<'a>> for TransformL
TransformOperation::Rotating(rotation) => { TransformOperation::Rotating(rotation) => {
let start_offset = *selected.pivot - self.mouse_position; let start_offset = *selected.pivot - self.mouse_position;
let end_offset = *selected.pivot - input.mouse.position; let end_offset = *selected.pivot - input.mouse.position;
let angle = start_offset.angle_between(end_offset); let angle = start_offset.angle_to(end_offset);
let change = if self.slow { angle / SLOWING_DIVISOR } else { angle }; let change = if self.slow { angle / SLOWING_DIVISOR } else { angle };
+1141 -4513
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -15,7 +15,7 @@ documentation = "https://graphite.rs/libraries/bezier-rs/"
[dependencies] [dependencies]
# Required dependencies # Required dependencies
glam = { version = "0.25", features = ["serde"] } glam = { version = "0.28", features = ["serde"] }
# Optional local dependencies # Optional local dependencies
dyn-any = { version = "0.3.0", path = "../dyn-any", optional = true } dyn-any = { version = "0.3.0", path = "../dyn-any", optional = true }
+4 -4
View File
@@ -273,7 +273,7 @@ impl Bezier {
BezierHandles::Cubic { .. } => { BezierHandles::Cubic { .. } => {
// Axis align the curve. // Axis align the curve.
let translated_bezier = self.translate(-self.start); let translated_bezier = self.translate(-self.start);
let angle = translated_bezier.end.angle_between(DVec2::new(1., 0.)); let angle = translated_bezier.end.angle_to(DVec2::new(1., 0.));
let rotated_bezier = translated_bezier.rotate(angle); let rotated_bezier = translated_bezier.rotate(angle);
if let BezierHandles::Cubic { handle_start, handle_end } = rotated_bezier.handles { if let BezierHandles::Cubic { handle_start, handle_end } = rotated_bezier.handles {
// These formulas and naming conventions follows https://pomax.github.io/bezierinfo/#inflections // These formulas and naming conventions follows https://pomax.github.io/bezierinfo/#inflections
@@ -413,7 +413,7 @@ impl Bezier {
if other.is_linear() { if other.is_linear() {
// Rotate the bezier and the line by the angle that the line makes with the x axis // Rotate the bezier and the line by the angle that the line makes with the x axis
let line_directional_vector = other.end - other.start; let line_directional_vector = other.end - other.start;
let angle = line_directional_vector.angle_between(DVec2::new(0., 1.)); let angle = line_directional_vector.angle_to(DVec2::new(0., 1.));
let rotation_matrix = DMat2::from_angle(angle); let rotation_matrix = DMat2::from_angle(angle);
let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point); let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point);
@@ -452,7 +452,7 @@ impl Bezier {
/// If this needs to be called frequently with a line of the same rotation angle, consider instead using [`line_test_crossings_prerotated`] and moving this function's setup code into your own logic before the repeated call. /// If this needs to be called frequently with a line of the same rotation angle, consider instead using [`line_test_crossings_prerotated`] and moving this function's setup code into your own logic before the repeated call.
pub fn line_test_crossings(&self, point_on_line: DVec2, direction_vector: DVec2) -> impl Iterator<Item = f64> + '_ { pub fn line_test_crossings(&self, point_on_line: DVec2, direction_vector: DVec2) -> impl Iterator<Item = f64> + '_ {
// Rotate the bezier and the line by the angle that the line makes with the x axis // Rotate the bezier and the line by the angle that the line makes with the x axis
let angle = direction_vector.angle_between(DVec2::new(0., 1.)); let angle = direction_vector.angle_to(DVec2::new(0., 1.));
let rotation_matrix = DMat2::from_angle(angle); let rotation_matrix = DMat2::from_angle(angle);
let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point); let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point);
@@ -476,7 +476,7 @@ impl Bezier {
/// If this needs to be called frequently with a ray of the same rotation angle, consider instead using [`ray_test_crossings_prerotated`] and moving this function's setup code into your own logic before the repeated call. /// If this needs to be called frequently with a ray of the same rotation angle, consider instead using [`ray_test_crossings_prerotated`] and moving this function's setup code into your own logic before the repeated call.
pub fn ray_test_crossings(&self, ray_start: DVec2, ray_direction: DVec2) -> impl Iterator<Item = f64> + '_ { pub fn ray_test_crossings(&self, ray_start: DVec2, ray_direction: DVec2) -> impl Iterator<Item = f64> + '_ {
// Rotate the bezier and the line by the angle that the line makes with the x axis // Rotate the bezier and the line by the angle that the line makes with the x axis
let angle = ray_direction.angle_between(DVec2::new(0., 1.)); let angle = ray_direction.angle_to(DVec2::new(0., 1.));
let rotation_matrix = DMat2::from_angle(angle); let rotation_matrix = DMat2::from_angle(angle);
let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point); let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point);
+5 -5
View File
@@ -140,8 +140,8 @@ impl Bezier {
} }
// Verify all the handles are located on a single side of the curve. // Verify all the handles are located on a single side of the curve.
if let BezierHandles::Cubic { handle_start, handle_end } = self.handles { if let BezierHandles::Cubic { handle_start, handle_end } = self.handles {
let angle_1 = (self.end - self.start).angle_between(handle_start - self.start); let angle_1 = (self.end - self.start).angle_to(handle_start - self.start);
let angle_2 = (self.end - self.start).angle_between(handle_end - self.start); let angle_2 = (self.end - self.start).angle_to(handle_end - self.start);
if (angle_1 > 0. && angle_2 < 0.) || (angle_1 < 0. && angle_2 > 0.) { if (angle_1 > 0. && angle_2 < 0.) || (angle_1 < 0. && angle_2 > 0.) {
return false; return false;
} }
@@ -533,9 +533,9 @@ impl Bezier {
let center = wrapped_center.unwrap(); let center = wrapped_center.unwrap();
let radius = center.distance(p1); let radius = center.distance(p1);
let angle_p1 = DVec2::new(1., 0.).angle_between(p1 - center); let angle_p1 = DVec2::new(1., 0.).angle_to(p1 - center);
let angle_p2 = DVec2::new(1., 0.).angle_between(p2 - center); let angle_p2 = DVec2::new(1., 0.).angle_to(p2 - center);
let angle_p3 = DVec2::new(1., 0.).angle_between(p3 - center); let angle_p3 = DVec2::new(1., 0.).angle_to(p3 - center);
let mut start_angle = angle_p1; let mut start_angle = angle_p1;
let mut end_angle = angle_p3; let mut end_angle = angle_p3;
+7 -7
View File
@@ -377,7 +377,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
// Draw the miter join if the intersection occurs in the correct direction with respect to the path // Draw the miter join if the intersection occurs in the correct direction with respect to the path
if start_to_intersection.normalize().abs_diff_eq(in_tangent, MAX_ABSOLUTE_DIFFERENCE) if start_to_intersection.normalize().abs_diff_eq(in_tangent, MAX_ABSOLUTE_DIFFERENCE)
&& intersection_to_end.normalize().abs_diff_eq(out_tangent, MAX_ABSOLUTE_DIFFERENCE) && intersection_to_end.normalize().abs_diff_eq(out_tangent, MAX_ABSOLUTE_DIFFERENCE)
&& miter_limit >= 1. / (start_to_intersection.angle_between(-intersection_to_end).abs() / 2.).sin() && miter_limit >= 1. / (start_to_intersection.angle_to(-intersection_to_end).abs() / 2.).sin()
{ {
return Some(ManipulatorGroup { return Some(ManipulatorGroup {
anchor: intersection, anchor: intersection,
@@ -406,10 +406,10 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
let in_segment = self.get_segment(self.len_segments() - 1).unwrap(); let in_segment = self.get_segment(self.len_segments() - 1).unwrap();
let in_tangent = in_segment.tangent(TValue::Parametric(1.)); let in_tangent = in_segment.tangent(TValue::Parametric(1.));
let mut angle = center_to_right.angle_between(center_to_left) / 2.; let mut angle = center_to_right.angle_to(center_to_left) / 2.;
let mut arc_point = center + DMat2::from_angle(angle).mul_vec2(center_to_right); let mut arc_point = center + DMat2::from_angle(angle).mul_vec2(center_to_right);
if (arc_point - left).angle_between(in_tangent).abs() > PI / 2. { if (arc_point - left).angle_to(in_tangent).abs() > PI / 2. {
angle = angle - PI * (if angle < 0. { -1. } else { 1. }); angle = angle - PI * (if angle < 0. { -1. } else { 1. });
arc_point = center + DMat2::from_angle(angle).mul_vec2(center_to_right); arc_point = center + DMat2::from_angle(angle).mul_vec2(center_to_right);
} }
@@ -874,8 +874,8 @@ mod tests {
let middle = (round_start + round_end) / 2.; let middle = (round_start + round_end) / 2.;
assert!((round_point - middle).angle_between(round_start - middle) > 0.); assert!((round_point - middle).angle_to(round_start - middle) > 0.);
assert!((round_end - middle).angle_between(round_point - middle) > 0.); assert!((round_end - middle).angle_to(round_point - middle) > 0.);
} }
#[test] #[test]
@@ -915,7 +915,7 @@ mod tests {
let middle = (round_start + round_end) / 2.; let middle = (round_start + round_end) / 2.;
assert!((round_point - middle).angle_between(round_start - middle) < 0.); assert!((round_point - middle).angle_to(round_start - middle) < 0.);
assert!((round_end - middle).angle_between(round_point - middle) < 0.); assert!((round_end - middle).angle_to(round_point - middle) < 0.);
} }
} }
+2 -2
View File
@@ -388,7 +388,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
// Calculate the angle formed between two consecutive Subpaths // Calculate the angle formed between two consecutive Subpaths
let out_tangent = self.get_segment(i).unwrap().tangent(TValue::Parametric(1.)); let out_tangent = self.get_segment(i).unwrap().tangent(TValue::Parametric(1.));
let in_tangent = self.get_segment(j).unwrap().tangent(TValue::Parametric(0.)); let in_tangent = self.get_segment(j).unwrap().tangent(TValue::Parametric(0.));
let angle = out_tangent.angle_between(in_tangent); let angle = out_tangent.angle_to(in_tangent);
// The angle is concave. The Subpath overlap and must be clipped // The angle is concave. The Subpath overlap and must be clipped
let mut apply_join = true; let mut apply_join = true;
@@ -428,7 +428,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
if self.closed { if self.closed {
let out_tangent = self.get_segment(self.len_segments() - 1).unwrap().tangent(TValue::Parametric(1.)); let out_tangent = self.get_segment(self.len_segments() - 1).unwrap().tangent(TValue::Parametric(1.));
let in_tangent = self.get_segment(0).unwrap().tangent(TValue::Parametric(0.)); let in_tangent = self.get_segment(0).unwrap().tangent(TValue::Parametric(0.));
let angle = out_tangent.angle_between(in_tangent); let angle = out_tangent.angle_to(in_tangent);
let mut apply_join = true; let mut apply_join = true;
if (angle > 0. && distance > 0.) || (angle < 0. && distance < 0.) { if (angle > 0. && distance > 0.) || (angle < 0. && distance < 0.) {
+1 -1
View File
@@ -29,7 +29,7 @@ dyn-any-derive = { path = "derive", optional = true }
# Optional dependencies # Optional dependencies
log = { version = "0.4", optional = true } log = { version = "0.4", optional = true }
glam = { version = "0.25", optional = true, default-features = false } glam = { version = "0.28", optional = true, default-features = false }
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@@ -51,7 +51,7 @@ impl Quad {
let offset = |index_before, index, index_after| { let offset = |index_before, index, index_after| {
let [point_before, point, point_after]: [DVec2; 3] = [self.0[index_before], self.0[index], self.0[index_after]]; let [point_before, point, point_after]: [DVec2; 3] = [self.0[index_before], self.0[index], self.0[index_after]];
let [line_in, line_out] = [point - point_before, point_after - point]; let [line_in, line_out] = [point - point_before, point_after - point];
let angle = line_in.angle_between(-line_out); let angle = line_in.angle_to(-line_out);
let offset_length = offset / (std::f64::consts::FRAC_PI_2 - angle / 2.).cos(); let offset_length = offset / (std::f64::consts::FRAC_PI_2 - angle / 2.).cos();
point + (line_in.perp().normalize_or_zero() + line_out.perp().normalize_or_zero()).normalize_or_zero() * offset_length point + (line_in.perp().normalize_or_zero() + line_out.perp().normalize_or_zero()).normalize_or_zero() * offset_length
}; };
+1 -1
View File
@@ -203,7 +203,7 @@ fn construct_vector2(_primary: (), x: f64, y: f64) -> glam::DVec2 {
// Size Of // Size Of
#[cfg(feature = "std")] #[cfg(feature = "std")]
struct SizeOfNode; pub struct SizeOfNode;
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[node_macro::node_fn(SizeOfNode)] #[node_macro::node_fn(SizeOfNode)]
fn flat_map(ty: crate::Type) -> Option<usize> { fn flat_map(ty: crate::Type) -> Option<usize> {
+1 -1
View File
@@ -81,7 +81,7 @@ impl<T: Linear + Debug + Copy> LinearChannel for T {}
use num_derive::*; use num_derive::*;
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Num, NumCast, NumOps, One, Zero, ToPrimitive, FromPrimitive)] #[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Num, NumCast, NumOps, One, Zero, ToPrimitive, FromPrimitive)]
struct SRGBGammaFloat(f32); pub struct SRGBGammaFloat(f32);
impl Channel for SRGBGammaFloat { impl Channel for SRGBGammaFloat {
#[inline(always)] #[inline(always)]
+1 -1
View File
@@ -178,7 +178,7 @@ impl Gradient {
let (start, end) = (transform.transform_point2(self.start), transform.transform_point2(self.end)); let (start, end) = (transform.transform_point2(self.start), transform.transform_point2(self.end));
// Calculate the new position by finding the closest point on the line // Calculate the new position by finding the closest point on the line
let new_position = ((end - start).angle_between(mouse - start)).cos() * start.distance(mouse) / start.distance(end); let new_position = ((end - start).angle_to(mouse - start)).cos() * start.distance(mouse) / start.distance(end);
// Don't insert point past end of line // Don't insert point past end of line
if !(0. ..=1.).contains(&new_position) { if !(0. ..=1.).contains(&new_position) {
+1 -1
View File
@@ -638,7 +638,7 @@ mod test {
for (index, (_, subpath)) in repeated.region_bezier_paths().enumerate() { for (index, (_, subpath)) in repeated.region_bezier_paths().enumerate() {
let expected_angle = (index as f64 + 1.) * 45.; let expected_angle = (index as f64 + 1.) * 45.;
let center = (subpath.manipulator_groups()[0].anchor + subpath.manipulator_groups()[2].anchor) / 2.; let center = (subpath.manipulator_groups()[0].anchor + subpath.manipulator_groups()[2].anchor) / 2.;
let actual_angle = DVec2::Y.angle_between(center).to_degrees(); let actual_angle = DVec2::Y.angle_to(center).to_degrees();
assert!((actual_angle - expected_angle).abs() % 360. < 1e-5); assert!((actual_angle - expected_angle).abs() % 360. < 1e-5);
} }
} }
+2969 -338
View File
File diff suppressed because it is too large Load Diff
+16 -13
View File
@@ -9,25 +9,28 @@ default = []
profiling = ["nvtx"] profiling = ["nvtx"]
serde = ["graphene-core/serde", "glam/serde"] serde = ["graphene-core/serde", "glam/serde"]
# NOTE: We can't use workspace dependencies in this crate because it uses a different toolchain
[dependencies] [dependencies]
# Local dependencies # Local dependencies
graph-craft = { path = "../graph-craft", features = ["serde"] } graph-craft = { path = "../graph-craft", features = ["serde"] }
gpu-executor = { path = "../gpu-executor" } gpu-executor = { path = "../gpu-executor" }
graphene-core = { path = "../gcore", features = ["std", "alloc"] }
# Workspace dependencies dyn-any = { path = "../../libraries/dyn-any", features = [
graphene-core = { workspace = true, features = ["async", "std", "alloc"] } "log-bad-types",
dyn-any = { workspace = true, features = ["log-bad-types", "rc", "glam"] } "rc",
num-traits = { workspace = true } "glam",
log = { workspace = true } ] }
serde = { workspace = true }
glam = { workspace = true }
base64 = { workspace = true }
bytemuck = { workspace = true }
tempfile = { workspace = true }
anyhow = { workspace = true }
serde_json = { workspace = true }
# Required dependencies # Required dependencies
num-traits = { version = "0.2", default-features = false, features = ["i128"] }
log = "0.4"
serde = { version = "1.0", features = ["derive", "rc"] }
glam = { version = "0.28", default-features = false, features = ["serde"] }
base64 = "0.22"
bytemuck = { version = "1.13", features = ["derive"] }
tempfile = "3.6"
anyhow = "1.0"
serde_json = "1.0"
tera = { version = "1.17.1" } tera = { version = "1.17.1" }
spirv-builder = { version = "0.9", default-features = false, features = [ spirv-builder = { version = "0.9", default-features = false, features = [
"use-installed-tools", "use-installed-tools",
+2
View File
@@ -9,6 +9,7 @@ default = ["dealloc_nodes"]
serde = ["dep:serde", "graphene-core/serde", "glam/serde", "bezier-rs/serde"] serde = ["dep:serde", "graphene-core/serde", "glam/serde", "bezier-rs/serde"]
dealloc_nodes = [] dealloc_nodes = []
wgpu = [] wgpu = []
tokio = ["dep:tokio"]
[dependencies] [dependencies]
# Local dependencies # Local dependencies
@@ -35,6 +36,7 @@ wgpu-executor = { workspace = true }
# Optional workspace dependencies # Optional workspace dependencies
serde = { workspace = true, optional = true } serde = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
# Workspace dependencies # Workspace dependencies
+1 -2
View File
@@ -225,8 +225,7 @@ fn to_svg_string(vector: &VectorData, transform: DAffine2) -> String {
fn from_svg_string(svg_string: &str) -> VectorData { fn from_svg_string(svg_string: &str) -> VectorData {
let svg = format!(r#"<svg xmlns="http://www.w3.org/2000/svg"><path d="{}"></path></svg>"#, svg_string); let svg = format!(r#"<svg xmlns="http://www.w3.org/2000/svg"><path d="{}"></path></svg>"#, svg_string);
let fontdb = usvg::fontdb::Database::new(); let Some(tree) = usvg::Tree::from_str(&svg, &Default::default()).ok() else {
let Some(tree) = usvg::Tree::from_str(&svg, &Default::default(), &fontdb).ok() else {
return VectorData::empty(); return VectorData::empty();
}; };
let Some(usvg::Node::Path(path)) = tree.root().children().first() else { let Some(usvg::Node::Path(path)) = tree.root().children().first() else {
File diff suppressed because it is too large Load Diff
@@ -33,8 +33,5 @@
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.4.2", "typescript": "^5.4.2",
"vite": "^5.1.5" "vite": "^5.1.5"
},
"optionalDependencies": {
"wasm-pack": "0.12.1"
} }
} }
@@ -6,16 +6,6 @@ use bezier_rs::{ArcStrategy, ArcsOptions, Bezier, Identifier, TValue, TValueType
use glam::DVec2; use glam::DVec2;
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
#[derive(serde::Serialize, serde::Deserialize)]
struct CircleSector {
center: DVec2,
radius: f64,
#[serde(rename = "startAngle")]
start_angle: f64,
#[serde(rename = "endAngle")]
end_angle: f64,
}
#[wasm_bindgen] #[wasm_bindgen]
pub enum WasmMaximizeArcs { pub enum WasmMaximizeArcs {
Automatic, // 0 Automatic, // 0
+1620 -2432
View File
File diff suppressed because it is too large Load Diff