fn close_path(
		&self,
		points: &mut Vec<VectorAnchor>,
		to_replace: usize,
		first_path_element: Option<IndexedEl>,
		last_path_element: Option<IndexedEl>,
		recent_move_to: Option<IndexedEl>,
		responses: &mut VecDeque<Message>,
	) {
		if let (Some(first), Some(last), Some(move_to)) = (first_path_element, last_path_element, recent_move_to) {
			let position_equal = match (move_to.1, last.1) {
				(PathEl::MoveTo(p1), PathEl::LineTo(p2)) => p1.distance_squared(p2) < 0.01,
				(PathEl::MoveTo(p1), PathEl::QuadTo(_, p2)) => p1.distance_squared(p2) < 0.01,
				(PathEl::MoveTo(p1), PathEl::CurveTo(_, _, p2)) => p1.distance_squared(p2) < 0.01,
				_ => false,
			};

			// Does this end in the same position it started?
			if position_equal {
				points[to_replace].remove_overlays(responses);
				points[to_replace] = self.create_anchor(Some(last), Some(first), responses);
				points[to_replace].close_element_id = Some(move_to.0);
			} else {
				points.push(self.create_anchor(Some(last), Some(first), responses));
			}
		}
	}
/// Close the path by checking if the distance between the last element and the first MoveTo is less than the tolerance.
/// If so, create a new anchor at the first point. Otherwise, create a new anchor at the last point.
Close the path by checking if the distance between the last element and the first MoveTo is less than the tolerance.
If so, create a new anchor at the first point. Otherwise, create a new anchor at the last point.
Close the path by checking if the distance between the last element and the first MoveTo is less than the tolerance . If so create a new anchor at the first point . Otherwise create a new anchor at the last point .
fn close_path(
		&self,
		points: &mut Vec<VectorAnchor>,
		to_replace: usize,
		first_path_element: Option<IndexedEl>,
		last_path_element: Option<IndexedEl>,
		recent_move_to: Option<IndexedEl>,
		responses: &mut VecDeque<Message>,
	) {
		if let (Some(first), Some(last), Some(move_to)) = (first_path_element, last_path_element, recent_move_to) {
			let position_equal = match (move_to.1, last.1) {
				(PathEl::MoveTo(p1), PathEl::LineTo(p2)) => p1.distance_squared(p2) < 0.01,
				(PathEl::MoveTo(p1), PathEl::QuadTo(_, p2)) => p1.distance_squared(p2) < 0.01,
				(PathEl::MoveTo(p1), PathEl::CurveTo(_, _, p2)) => p1.distance_squared(p2) < 0.01,
				_ => false,
			};
			// Does this end in the same position it started?
			if position_equal {
				points[to_replace].remove_overlays(responses);
				points[to_replace] = self.create_anchor(Some(last), Some(first), responses);
				points[to_replace].close_element_id = Some(move_to.0);
			} else {
				points.push(self.create_anchor(Some(last), Some(first), responses));
			}
		}
	}
fn close_path ( & self , points : & mut Vec < VectorAnchor > , to_replace : usize , first_path_element : Option < IndexedEl > , last_path_element : Option < IndexedEl > , recent_move_to : Option < IndexedEl > , responses : & mut VecDeque < Message > , ) { if let ( Some ( first ) , Some ( last ) , Some ( move_to ) ) = ( first_path_element , last_path_element , recent_move_to ) { let position_equal = match ( move_to . 1 , last . 1 ) { ( PathEl :: MoveTo ( p1 ) , PathEl :: LineTo ( p2 ) ) => p1 . distance_squared ( p2 ) < 0.01 , ( PathEl :: MoveTo ( p1 ) , PathEl :: QuadTo ( _ , p2 ) ) => p1 . distance_squared ( p2 ) < 0.01 , ( PathEl :: MoveTo ( p1 ) , PathEl :: CurveTo ( _ , _ , p2 ) ) => p1 . distance_squared ( p2 ) < 0.01 , _ => false , } ; // Does this end in the same position it started? if position_equal { points [ to_replace ] . remove_overlays ( responses ) ; points [ to_replace ] = self . create_anchor ( Some ( last ) , Some ( first ) , responses ) ; points [ to_replace ] . close_element_id = Some ( move_to . 0 ) ; } else { points . push ( self . create_anchor ( Some ( last ) , Some ( first ) , responses ) ) ; } } }
Close the path by checking if the distance between the last element and the first MoveTo is less than the tolerance.
Close the path by checking if the distance between the last element and the first MoveTo is less than the tolerance .
&self
points
&mut Vec<VectorAnchor>
to_replace
usize
first_path_element
Option<IndexedEl>
last_path_element
Option<IndexedEl>
recent_move_to
Option<IndexedEl>
responses
&mut VecDeque<Message>
&self
points
&mut Vec<VectorAnchor>
to_replace
usize
first_path_element
Option<IndexedEl>
last_path_element
Option<IndexedEl>
recent_move_to
Option<IndexedEl>
responses
&mut VecDeque<Message>