mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 14:08:12 +08:00
Layer and grid snapping systems (#1521)
* Grid overlays * Rectangle tool basic snapping * Fix bezier demos * Fix bézier crate tests * Constrained snapping for circle & shape tool * Line tool snapping * Pen tool snapping * Path tool snapping * Snapping whilst dragging layers (not constrained) * Constrained drag * Resize snapping * Normal and tangent * Cleanup * Grid snapping * Grid snapping * Fix imports * Fix bug in artboard tool * Fix hang on 0 size grid spacing * Fix NaN when scaling * Polishing --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
78a1bb17cd
commit
456ca170a4
@@ -90,10 +90,10 @@ impl<ManipulatorGroupId: crate::Identifier> Subpath<ManipulatorGroupId> {
|
||||
|
||||
// TODO: Consider the shared point between adjacent beziers.
|
||||
self.iter().enumerate().fold([Vec::new(), Vec::new()], |mut acc, elem| {
|
||||
let extremas = elem.1.local_extrema();
|
||||
let [x, y] = elem.1.local_extrema();
|
||||
// Convert t-values of bezier curve to t-values of subpath
|
||||
acc[0].extend(extremas[0].iter().map(|t| ((elem.0 as f64) + t) / number_of_curves).collect::<Vec<f64>>());
|
||||
acc[1].extend(extremas[1].iter().map(|t| ((elem.0 as f64) + t) / number_of_curves).collect::<Vec<f64>>());
|
||||
acc[0].extend(x.map(|t| ((elem.0 as f64) + t) / number_of_curves).collect::<Vec<f64>>());
|
||||
acc[1].extend(y.map(|t| ((elem.0 as f64) + t) / number_of_curves).collect::<Vec<f64>>());
|
||||
acc
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user