fn update_anchors_from_kurbo(&mut self, path: &BezPath) {
		let space_transform = |point: kurbo::Point| self.transform.transform_point2(DVec2::from((point.x, point.y)));
		for anchor_index in 0..self.anchors.len() {
			let elements = path.elements();
			let anchor = &mut self.anchors[anchor_index];
			if let Some(anchor_point) = &mut anchor.points[ControlPointType::Anchor] {
				match elements[anchor_point.kurbo_element_id] {
					kurbo::PathEl::MoveTo(anchor_position) | kurbo::PathEl::LineTo(anchor_position) => anchor.set_point_position(ControlPointType::Anchor as usize, space_transform(anchor_position)),
					kurbo::PathEl::QuadTo(handle_position, anchor_position) | kurbo::PathEl::CurveTo(_, handle_position, anchor_position) => {
						anchor.set_point_position(ControlPointType::Anchor as usize, space_transform(anchor_position));
						if anchor.points[ControlPointType::Handle1].is_some() {
							anchor.set_point_position(ControlPointType::Handle1 as usize, space_transform(handle_position));
						}
					}
					_ => (),
				}
				if let Some(handle) = &mut anchor.points[ControlPointType::Handle2] {
					match elements[handle.kurbo_element_id] {
						kurbo::PathEl::CurveTo(handle_position, _, _) | kurbo::PathEl::QuadTo(handle_position, _) => {
							anchor.set_point_position(ControlPointType::Handle2 as usize, space_transform(handle_position));
						}
						_ => (),
					}
				}
			}
		}
	}
/// Update the anchors to match the kurbo path
Update the anchors to match the kurbo path
Update the anchors to match the kurbo path
fn update_anchors_from_kurbo(&mut self, path: &BezPath) {
		let space_transform = |point: kurbo::Point| self.transform.transform_point2(DVec2::from((point.x, point.y)));
		for anchor_index in 0..self.anchors.len() {
			let elements = path.elements();
			let anchor = &mut self.anchors[anchor_index];
			if let Some(anchor_point) = &mut anchor.points[ControlPointType::Anchor] {
				match elements[anchor_point.kurbo_element_id] {
					kurbo::PathEl::MoveTo(anchor_position) | kurbo::PathEl::LineTo(anchor_position) => anchor.set_point_position(ControlPointType::Anchor as usize, space_transform(anchor_position)),
					kurbo::PathEl::QuadTo(handle_position, anchor_position) | kurbo::PathEl::CurveTo(_, handle_position, anchor_position) => {
						anchor.set_point_position(ControlPointType::Anchor as usize, space_transform(anchor_position));
						if anchor.points[ControlPointType::Handle1].is_some() {
							anchor.set_point_position(ControlPointType::Handle1 as usize, space_transform(handle_position));
						}
					}
					_ => (),
				}
				if let Some(handle) = &mut anchor.points[ControlPointType::Handle2] {
					match elements[handle.kurbo_element_id] {
						kurbo::PathEl::CurveTo(handle_position, _, _) | kurbo::PathEl::QuadTo(handle_position, _) => {
							anchor.set_point_position(ControlPointType::Handle2 as usize, space_transform(handle_position));
						}
						_ => (),
					}
				}
			}
		}
	}
fn update_anchors_from_kurbo ( & mut self , path : & BezPath ) { let space_transform = | point : kurbo :: Point | self . transform . transform_point2 ( DVec2 :: from ( ( point . x , point . y ) ) ) ; for anchor_index in 0 .. self . anchors . len ( ) { let elements = path . elements ( ) ; let anchor = & mut self . anchors [ anchor_index ] ; if let Some ( anchor_point ) = & mut anchor . points [ ControlPointType :: Anchor ] { match elements [ anchor_point . kurbo_element_id ] { kurbo :: PathEl :: MoveTo ( anchor_position ) | kurbo :: PathEl :: LineTo ( anchor_position ) => anchor . set_point_position ( ControlPointType :: Anchor as usize , space_transform ( anchor_position ) ) , kurbo :: PathEl :: QuadTo ( handle_position , anchor_position ) | kurbo :: PathEl :: CurveTo ( _ , handle_position , anchor_position ) => { anchor . set_point_position ( ControlPointType :: Anchor as usize , space_transform ( anchor_position ) ) ; if anchor . points [ ControlPointType :: Handle1 ] . is_some ( ) { anchor . set_point_position ( ControlPointType :: Handle1 as usize , space_transform ( handle_position ) ) ; } } _ => ( ) , } if let Some ( handle ) = & mut anchor . points [ ControlPointType :: Handle2 ] { match elements [ handle . kurbo_element_id ] { kurbo :: PathEl :: CurveTo ( handle_position , _ , _ ) | kurbo :: PathEl :: QuadTo ( handle_position , _ ) => { anchor . set_point_position ( ControlPointType :: Handle2 as usize , space_transform ( handle_position ) ) ; } _ => ( ) , } } } } }
Update the anchors to match the kurbo path
Update the anchors to match the kurbo path
&mut self
path
&BezPath
&mut self
path
&BezPath