fn create_anchor(&self, first: Option<IndexedEl>, second: Option<IndexedEl>, responses: &mut VecDeque<Message>) -> VectorAnchor {
		let mut handle1 = None;
		let mut anchor_position: glam::DVec2 = glam::DVec2::ZERO;
		let mut handle2 = None;
		let mut anchor_element_id: usize = 0;

		let create_point = |id: usize, point: DVec2, overlay_path: Vec<LayerId>, manipulator_type: ControlPointType| -> VectorControlPoint {
			VectorControlPoint {
				kurbo_element_id: id,
				position: point,
				overlay_path: Some(overlay_path),
				can_be_selected: true,
				manipulator_type,
				is_selected: false,
			}
		};

		if let Some((first_element_id, first_element)) = first {
			anchor_element_id = first_element_id;
			match first_element {
				kurbo::PathEl::MoveTo(anchor) | kurbo::PathEl::LineTo(anchor) => anchor_position = self.to_local_space(anchor),
				kurbo::PathEl::QuadTo(handle, anchor) | kurbo::PathEl::CurveTo(_, handle, anchor) => {
					anchor_position = self.to_local_space(anchor);
					handle1 = Some(create_point(
						first_element_id,
						self.to_local_space(handle),
						self.create_handle_overlay(responses),
						ControlPointType::Handle1,
					));
				}
				_ => (),
			}
		}

		if let Some((second_element_id, second_element)) = second {
			match second_element {
				kurbo::PathEl::CurveTo(handle, _, _) | kurbo::PathEl::QuadTo(handle, _) => {
					handle2 = Some(create_point(
						second_element_id,
						self.to_local_space(handle),
						self.create_handle_overlay(responses),
						ControlPointType::Handle2,
					));
				}
				_ => (),
			}
		}

		VectorAnchor {
			handle_line_overlays: (self.create_handle_line_overlay(&handle1, responses), self.create_handle_line_overlay(&handle2, responses)),
			points: [
				Some(create_point(anchor_element_id, anchor_position, self.create_anchor_overlay(responses), ControlPointType::Anchor)),
				handle1,
				handle2,
			],
			close_element_id: None,
			handle_mirror_angle: true,
			handle_mirror_distance: false,
		}
	}
/// Create an anchor on the boundary between two kurbo PathElements with optional handles
Create an anchor on the boundary between two kurbo PathElements with optional handles
Create an anchor on the boundary between two kurbo PathElements with optional handles
fn create_anchor(&self, first: Option<IndexedEl>, second: Option<IndexedEl>, responses: &mut VecDeque<Message>) -> VectorAnchor {
		let mut handle1 = None;
		let mut anchor_position: glam::DVec2 = glam::DVec2::ZERO;
		let mut handle2 = None;
		let mut anchor_element_id: usize = 0;
		let create_point = |id: usize, point: DVec2, overlay_path: Vec<LayerId>, manipulator_type: ControlPointType| -> VectorControlPoint {
			VectorControlPoint {
				kurbo_element_id: id,
				position: point,
				overlay_path: Some(overlay_path),
				can_be_selected: true,
				manipulator_type,
				is_selected: false,
			}
		};
		if let Some((first_element_id, first_element)) = first {
			anchor_element_id = first_element_id;
			match first_element {
				kurbo::PathEl::MoveTo(anchor) | kurbo::PathEl::LineTo(anchor) => anchor_position = self.to_local_space(anchor),
				kurbo::PathEl::QuadTo(handle, anchor) | kurbo::PathEl::CurveTo(_, handle, anchor) => {
					anchor_position = self.to_local_space(anchor);
					handle1 = Some(create_point(
						first_element_id,
						self.to_local_space(handle),
						self.create_handle_overlay(responses),
						ControlPointType::Handle1,
					));
				}
				_ => (),
			}
		}
		if let Some((second_element_id, second_element)) = second {
			match second_element {
				kurbo::PathEl::CurveTo(handle, _, _) | kurbo::PathEl::QuadTo(handle, _) => {
					handle2 = Some(create_point(
						second_element_id,
						self.to_local_space(handle),
						self.create_handle_overlay(responses),
						ControlPointType::Handle2,
					));
				}
				_ => (),
			}
		}
		VectorAnchor {
			handle_line_overlays: (self.create_handle_line_overlay(&handle1, responses), self.create_handle_line_overlay(&handle2, responses)),
			points: [
				Some(create_point(anchor_element_id, anchor_position, self.create_anchor_overlay(responses), ControlPointType::Anchor)),
				handle1,
				handle2,
			],
			close_element_id: None,
			handle_mirror_angle: true,
			handle_mirror_distance: false,
		}
	}
fn create_anchor ( & self , first : Option < IndexedEl > , second : Option < IndexedEl > , responses : & mut VecDeque < Message > ) -> VectorAnchor { let mut handle1 = None ; let mut anchor_position : glam :: DVec2 = glam :: DVec2 :: ZERO ; let mut handle2 = None ; let mut anchor_element_id : usize = 0 ; let create_point = | id : usize , point : DVec2 , overlay_path : Vec < LayerId > , manipulator_type : ControlPointType | -> VectorControlPoint { VectorControlPoint { kurbo_element_id : id , position : point , overlay_path : Some ( overlay_path ) , can_be_selected : true , manipulator_type , is_selected : false , } } ; if let Some ( ( first_element_id , first_element ) ) = first { anchor_element_id = first_element_id ; match first_element { kurbo :: PathEl :: MoveTo ( anchor ) | kurbo :: PathEl :: LineTo ( anchor ) => anchor_position = self . to_local_space ( anchor ) , kurbo :: PathEl :: QuadTo ( handle , anchor ) | kurbo :: PathEl :: CurveTo ( _ , handle , anchor ) => { anchor_position = self . to_local_space ( anchor ) ; handle1 = Some ( create_point ( first_element_id , self . to_local_space ( handle ) , self . create_handle_overlay ( responses ) , ControlPointType :: Handle1 , ) ) ; } _ => ( ) , } } if let Some ( ( second_element_id , second_element ) ) = second { match second_element { kurbo :: PathEl :: CurveTo ( handle , _ , _ ) | kurbo :: PathEl :: QuadTo ( handle , _ ) => { handle2 = Some ( create_point ( second_element_id , self . to_local_space ( handle ) , self . create_handle_overlay ( responses ) , ControlPointType :: Handle2 , ) ) ; } _ => ( ) , } } VectorAnchor { handle_line_overlays : ( self . create_handle_line_overlay ( & handle1 , responses ) , self . create_handle_line_overlay ( & handle2 , responses ) ) , points : [ Some ( create_point ( anchor_element_id , anchor_position , self . create_anchor_overlay ( responses ) , ControlPointType :: Anchor ) ) , handle1 , handle2 , ] , close_element_id : None , handle_mirror_angle : true , handle_mirror_distance : false , } }
Create an anchor on the boundary between two kurbo PathElements with optional handles
Create an anchor on the boundary between two kurbo PathElements with optional handles
&self
first
Option<IndexedEl>
second
Option<IndexedEl>
responses
&mut VecDeque<Message>
&self
first
Option<IndexedEl>
second
Option<IndexedEl>
responses
&mut VecDeque<Message>