pub fn select_point(&mut self, mouse_position: DVec2, select_threshold: f64, add_to_selection: bool, responses: &mut VecDeque<Message>) -> bool {
		if self.shapes_to_modify.is_empty() {
			return false;
		}

		if let Some((shape_index, anchor_index, point_index)) = self.find_nearest_point_indicies(mouse_position, select_threshold) {
			log::trace!("Selecting: shape {} / anchor {} / point {}", shape_index, anchor_index, point_index);

			// Add this shape to the selection
			self.set_shape_selected(shape_index);

			// If the point we're selecting has already been selected
			// we can assume this point exists.. since we did just click on it hense the unwrap
			let is_point_selected = self.shapes_to_modify[shape_index].anchors[anchor_index].points[point_index].as_ref().unwrap().is_selected;

			// Deselected if we're not adding to the selection
			if !add_to_selection && !is_point_selected {
				self.deselect_all(responses);
			}

			let selected_shape = &mut self.shapes_to_modify[shape_index];
			selected_shape.elements = selected_shape.bez_path.clone().into_iter().collect();

			// Should we select or deselect the point?
			let should_select = if is_point_selected { !(add_to_selection && is_point_selected) } else { true };

			// Add which anchor and point was selected
			let selected_anchor = selected_shape.select_anchor(anchor_index);
			selected_anchor.select_point(point_index, should_select, responses);

			// Due to the shape data structure not persisting across shape selection changes we need to rely on the kurbo path to know if we should mirror
			selected_anchor.set_mirroring((selected_anchor.angle_between_handles().abs() - std::f64::consts::PI).abs() < MINIMUM_MIRROR_THRESHOLD);
			return true;
		}
		false
	}
/// Select the first point within the selection threshold
/// Returns true if we've found a point, false otherwise
Select the first point within the selection threshold
Returns true if we've found a point, false otherwise
Select the first point within the selection threshold Returns true if we ' ve found a point false otherwise
pub fn select_point(&mut self, mouse_position: DVec2, select_threshold: f64, add_to_selection: bool, responses: &mut VecDeque<Message>) -> bool {
		if self.shapes_to_modify.is_empty() {
			return false;
		}
		if let Some((shape_index, anchor_index, point_index)) = self.find_nearest_point_indicies(mouse_position, select_threshold) {
			log::trace!("Selecting: shape {} / anchor {} / point {}", shape_index, anchor_index, point_index);
			// Add this shape to the selection
			self.set_shape_selected(shape_index);
			// If the point we're selecting has already been selected
			// we can assume this point exists.. since we did just click on it hense the unwrap
			let is_point_selected = self.shapes_to_modify[shape_index].anchors[anchor_index].points[point_index].as_ref().unwrap().is_selected;
			// Deselected if we're not adding to the selection
			if !add_to_selection && !is_point_selected {
				self.deselect_all(responses);
			}
			let selected_shape = &mut self.shapes_to_modify[shape_index];
			selected_shape.elements = selected_shape.bez_path.clone().into_iter().collect();
			// Should we select or deselect the point?
			let should_select = if is_point_selected { !(add_to_selection && is_point_selected) } else { true };
			// Add which anchor and point was selected
			let selected_anchor = selected_shape.select_anchor(anchor_index);
			selected_anchor.select_point(point_index, should_select, responses);
			// Due to the shape data structure not persisting across shape selection changes we need to rely on the kurbo path to know if we should mirror
			selected_anchor.set_mirroring((selected_anchor.angle_between_handles().abs() - std::f64::consts::PI).abs() < MINIMUM_MIRROR_THRESHOLD);
			return true;
		}
		false
	}
pub fn select_point ( & mut self , mouse_position : DVec2 , select_threshold : f64 , add_to_selection : bool , responses : & mut VecDeque < Message > ) -> bool { if self . shapes_to_modify . is_empty ( ) { return false ; } if let Some ( ( shape_index , anchor_index , point_index ) ) = self . find_nearest_point_indicies ( mouse_position , select_threshold ) { log :: trace ! ( " " shape_index anchor_index point_index ) ; // Add this shape to the selection self . set_shape_selected ( shape_index ) ; // If the point we're selecting has already been selected // we can assume this point exists.. since we did just click on it hense the unwrap let is_point_selected = self . shapes_to_modify [ shape_index ] . anchors [ anchor_index ] . points [ point_index ] . as_ref ( ) . unwrap ( ) . is_selected ; // Deselected if we're not adding to the selection if ! add_to_selection && ! is_point_selected { self . deselect_all ( responses ) ; } let selected_shape = & mut self . shapes_to_modify [ shape_index ] ; selected_shape . elements = selected_shape . bez_path . clone ( ) . into_iter ( ) . collect ( ) ; // Should we select or deselect the point? let should_select = if is_point_selected { ! ( add_to_selection && is_point_selected ) } else { true } ; // Add which anchor and point was selected let selected_anchor = selected_shape . select_anchor ( anchor_index ) ; selected_anchor . select_point ( point_index , should_select , responses ) ; // Due to the shape data structure not persisting across shape selection changes we need to rely on the kurbo path to know if we should mirror selected_anchor . set_mirroring ( ( selected_anchor . angle_between_handles ( ) . abs ( ) - std :: f64 :: consts :: PI ) . abs ( ) < MINIMUM_MIRROR_THRESHOLD ) ; return true ; } false }
Select the first point within the selection threshold
Returns true if we've found a point, false otherwise
Select the first point within the selection threshold Returns true if we ' ve found a point false otherwise
&mut self
mouse_position
DVec2
select_threshold
f64
add_to_selection
bool
responses
&mut VecDeque<Message>
&mut self
mouse_position
DVec2
select_threshold
f64
add_to_selection
bool
responses
&mut VecDeque<Message>