mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-07 15:55:00 +00:00
Fix several bugged vector-related nodes
This commit is contained in:
parent
feba87449b
commit
b81f48385a
4 changed files with 5 additions and 7 deletions
|
@ -360,11 +360,9 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
|
|||
/// The intersections of segments of the subpath are joined using the method specified by the `join` argument.
|
||||
/// <iframe frameBorder="0" width="100%" height="400px" src="https://graphite.rs/libraries/bezier-rs#subpath/offset/solo" title="Offset Demo"></iframe>
|
||||
pub fn offset(&self, distance: f64, join: Join) -> Subpath<PointId> {
|
||||
assert!(self.len_segments() > 1, "Cannot offset an empty Subpath.");
|
||||
|
||||
// An offset at a distance 0 from the curve is simply the same curve
|
||||
// An offset of a single point is not defined
|
||||
if distance == 0. || self.len() == 1 {
|
||||
if distance == 0. || self.len() <= 1 || self.len_segments() < 1 {
|
||||
return self.clone();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ pub use raster::Color;
|
|||
pub use types::Cow;
|
||||
|
||||
// pub trait Node: for<'n> NodeIO<'n> {
|
||||
/// The node trait allows for defining any node. Nodes can only take one input, however they can store references to other nodes inside the struct.
|
||||
/// The node trait allows for defining any node. Nodes can only take one call argument input, however they can store references to other nodes inside the struct.
|
||||
/// See `node-graph/README.md` for information on how to define a new node.
|
||||
pub trait Node<'i, Input: 'i>: 'i {
|
||||
type Output: 'i;
|
||||
|
|
|
@ -252,7 +252,7 @@ async fn transform<I: Into<Footprint> + 'n + ApplyTransform + Clone + Send + Syn
|
|||
data
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Debug"))]
|
||||
#[node_macro::node(category(""))]
|
||||
fn replace_transform<Data: TransformMut, TransformInput: Transform>(
|
||||
_: (),
|
||||
#[implementations(VectorData, ImageFrame<Color>, GraphicGroup)] mut data: Data,
|
||||
|
|
|
@ -936,10 +936,10 @@ async fn jitter_points<F: 'n + Send>(
|
|||
match handles {
|
||||
bezier_rs::BezierHandles::Cubic { handle_start, handle_end } => {
|
||||
*handle_start = vector_data.transform.transform_point2(*handle_start) + start_delta;
|
||||
*handle_end += vector_data.transform.transform_point2(*handle_end) + end_delta;
|
||||
*handle_end = vector_data.transform.transform_point2(*handle_end) + end_delta;
|
||||
}
|
||||
bezier_rs::BezierHandles::Quadratic { handle } => {
|
||||
*handle += vector_data.transform.transform_point2(*handle) + (start_delta + end_delta) / 2.;
|
||||
*handle = vector_data.transform.transform_point2(*handle) + (start_delta + end_delta) / 2.;
|
||||
}
|
||||
bezier_rs::BezierHandles::Linear => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue