Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor internal shape and remove reliance on Kurbo (PR #617) - Disentangle Kurbo#619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
6155c0457434487cf07cd15ebe95File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| pub mod constants; | ||
| pub mod overlay_renderer; | ||
| pub mod shape_adapter; | ||
| pub mod shape_editor; | ||
| pub mod vector_anchor; | ||
| pub mod vector_control_point; | ||
| pub mod vector_shape; | ||
| use graphene::layers::vector::vector_anchor; | ||
| use graphene::layers::vector::vector_control_point; | ||
| use graphene::layers::vector::vector_shape; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -30,7 +30,7 @@ impl LayerData for ShapeLayer { | ||
| let _ = write!(svg, "<!-- SVG shape has an invalid transform -->"); | ||
| return; | ||
| } | ||
| path.apply_affine(glam_to_kurbo(transform)); | ||
| path.apply_affine(transform); | ||
| let _ = writeln!(svg, r#"<g transform="matrix("#); | ||
| inverse.to_cols_array().iter().enumerate().for_each(|(i, entry)| { | ||
| @@ -48,14 +48,14 @@ impl LayerData for ShapeLayer { | ||
| if transform.matrix2 == DMat2::ZERO { | ||
| return None; | ||
| } | ||
| path.apply_affine(glam_to_kurbo(transform)); | ||
| path.apply_affine(transform); | ||
| let kurbo::Rect { x0, y0, x1, y1 } = path.bounding_box(); | ||
| Some([(x0, y0).into(), (x1, y1).into()]) | ||
| } | ||
| fn intersects_quad(&self, quad: Quad, path: &mut Vec<LayerId>, intersections: &mut Vec<Vec<LayerId>>) { | ||
| if intersect_quad_bez_path(quad, &self.shape, self.style.fill().is_some()) { | ||
| if intersect_quad_bez_path(quad, &(&self.shape).into(), self.style.fill().is_some()) { | ||
| intersections.push(path.clone()); | ||
| } | ||
| } | ||
| @@ -73,7 +73,7 @@ impl ShapeLayer { | ||
| pub fn from_bez_path(bez_path: BezPath, style: PathStyle, closed: bool) -> Self { | ||
| Self { | ||
| shape: bez_path, | ||
| shape: bez_path.iter().into(), | ||
| style, | ||
| render_index: 1, | ||
| closed, | ||
| @@ -106,7 +106,7 @@ impl ShapeLayer { | ||
| path.close_path(); | ||
| Self { | ||
| shape: path, | ||
| shape: path.iter().into(), | ||
| style, | ||
| render_index: 1, | ||
| closed: true, | ||
| @@ -115,7 +115,7 @@ impl ShapeLayer { | ||
| pub fn rectangle(style: PathStyle) -> Self { | ||
| Self { | ||
| shape: kurbo::Rect::new(0., 0., 1., 1.).to_path(0.01), | ||
| shape: VectorShape::from_kurbo_shape(&kurbo::Rect::new(0., 0., 1., 1.).to_path(0.01)), | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good stand in for now, but we will eventually want to define ways of creating shapes directly as VectorShapes. (Not a complaint, just context) | ||
| style, | ||
| render_index: 1, | ||
| closed: true, | ||
| @@ -124,7 +124,7 @@ impl ShapeLayer { | ||
| pub fn ellipse(style: PathStyle) -> Self { | ||
| Self { | ||
| shape: kurbo::Ellipse::from_rect(kurbo::Rect::new(0., 0., 1., 1.)).to_path(0.01), | ||
| shape: VectorShape::from_kurbo_shape(&kurbo::Ellipse::from_rect(kurbo::Rect::new(0., 0., 1., 1.)).to_path(0.01)), | ||
| style, | ||
| render_index: 1, | ||
| closed: true, | ||
| @@ -133,7 +133,7 @@ impl ShapeLayer { | ||
| pub fn line(style: PathStyle) -> Self { | ||
| Self { | ||
| shape: kurbo::Line::new((0., 0.), (1., 0.)).to_path(0.01), | ||
| shape: VectorShape::from_kurbo_shape(&kurbo::Line::new((0., 0.), (1., 0.)).to_path(0.01)), | ||
| style, | ||
| render_index: 1, | ||
| closed: false, | ||
| @@ -150,7 +150,7 @@ impl ShapeLayer { | ||
| .for_each(|(i, p)| if i == 0 { path.move_to(p) } else { path.line_to(p) }); | ||
| Self { | ||
| shape: path, | ||
| shape: path.iter().into(), | ||
| style, | ||
| render_index: 0, | ||
| closed: false, | ||
| @@ -228,7 +228,7 @@ impl ShapeLayer { | ||
| } | ||
| Self { | ||
| shape: path, | ||
| shape: path.iter().into(), | ||
| style, | ||
| render_index: 0, | ||
| closed: false, | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this have any downstream consequences? Do we no longer need it to be affine or is it already affine? Just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo_viewport * shape_transform is glam::DAffine2, that line was just coverting to kurbo::Affine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which now happens in the apply_affine function, but we should be able to implement that function without kurbo once we get affine transformations for the anchor points working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of off topic, why does
VectorAnchor::move_selected_points(&mut self, translation:DVec2, relative: bool, transform: &DAffine2)take both a translation and a transform?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally we needed it to do some kind of kurbo space transform to viewport transform space I believe. We may need it again, we'll see!