Bezier-rs: Insert function for subpath (#876)

* Add manipulator

* Add manipulator group

* Add UI

* Address comments and rebase

* Renamed add_manipulator_group to insert

Co-authored-by: Rob Nadal <robnadal44@gmail.com>
This commit is contained in:
Hannah Li
2023-01-12 18:26:25 -08:00
committed by Keavon Chambers
co-authored by Rob Nadal
parent 23b4306eab
commit 05a2cd32a5
5 changed files with 194 additions and 0 deletions
@@ -1,8 +1,24 @@
use glam::DVec2;
use std::fmt::{Debug, Formatter, Result};
/// Structure used to represent a single anchor with up to two optional associated handles along a `Subpath`
#[derive(Copy, Clone, PartialEq)]
pub struct ManipulatorGroup {
pub anchor: DVec2,
pub in_handle: Option<DVec2>,
pub out_handle: Option<DVec2>,
}
impl Debug for ManipulatorGroup {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
if self.in_handle.is_some() && self.out_handle.is_some() {
write!(f, "anchor: {}, in: {}, out: {}", self.anchor, self.in_handle.unwrap(), self.out_handle.unwrap())
} else if self.in_handle.is_some() {
write!(f, "anchor: {}, in: {}, out: n/a", self.anchor, self.in_handle.unwrap())
} else if self.out_handle.is_some() {
write!(f, "anchor: {}, in: n/a, out: {}", self.anchor, self.out_handle.unwrap())
} else {
write!(f, "anchor: {}, in: n/a, out: n/a", self.anchor)
}
}
}