@@ -397,7 +397,6 @@ impl PathToolData {
397397 }
398398 self . drag_start_pos = input. mouse . position ;
399399 self . previous_mouse_position = document. metadata ( ) . document_to_viewport . inverse ( ) . transform_point2 ( input. mouse . position ) ;
400- shape_editor. select_connected_anchors ( document, layer, input. mouse . position ) ;
401400
402401 responses. add ( DocumentMessage :: StartTransaction ) ;
403402
@@ -566,6 +565,7 @@ impl Fsm for PathToolFsmState {
566565 ) => {
567566 let extend_selection = input. keyboard . get ( extend_selection as usize ) ;
568567 let direct_insert_without_sliding = input. keyboard . get ( direct_insert_without_sliding as usize ) ;
568+
569569 tool_data. mouse_down ( shape_editor, document, input, responses, extend_selection, direct_insert_without_sliding)
570570 }
571571 (
@@ -606,6 +606,12 @@ impl Fsm for PathToolFsmState {
606606 move_anchor_with_handles,
607607 } ,
608608 ) => {
609+ if tool_data. selection_status . is_none ( ) {
610+ if let Some ( layer) = document. click ( input) {
611+ shape_editor. select_all_anchors_in_layer ( document, layer) ;
612+ }
613+ }
614+
609615 let anchor_and_handle_toggled = input. keyboard . get ( move_anchor_with_handles as usize ) ;
610616 let initial_press = anchor_and_handle_toggled && !tool_data. select_anchor_toggled ;
611617 let released_from_toggle = tool_data. select_anchor_toggled && !anchor_and_handle_toggled;
@@ -749,10 +755,15 @@ impl Fsm for PathToolFsmState {
749755 }
750756 }
751757 }
758+ // Deselect all points if the user clicks the filled region of the shape
759+ else if tool_data. drag_start_pos . distance ( input. mouse . position ) <= DRAG_THRESHOLD {
760+ shape_editor. deselect_all_points ( ) ;
761+ }
752762
753763 responses. add ( DocumentMessage :: EndTransaction ) ;
754764 responses. add ( PathToolMessage :: SelectedPointUpdated ) ;
755765 tool_data. snap_manager . cleanup ( responses) ;
766+
756767 PathToolFsmState :: Ready
757768 }
758769
@@ -774,11 +785,25 @@ impl Fsm for PathToolFsmState {
774785 PathToolFsmState :: Ready
775786 }
776787 ( _, PathToolMessage :: FlipSmoothSharp ) => {
777- if !tool_data. double_click_handled {
778- shape_editor. flip_smooth_sharp ( & document. network_interface , input. mouse . position , SELECTION_TOLERANCE , responses) ;
779- responses. add ( PathToolMessage :: SelectedPointUpdated ) ;
788+ // Double-clicked on a point
789+ let nearest_point = shape_editor. find_nearest_point_indices ( & document. network_interface , input. mouse . position , SELECTION_THRESHOLD ) ;
790+ if nearest_point. is_some ( ) {
791+ // Flip the selected point between smooth and sharp
792+ if !tool_data. double_click_handled && tool_data. drag_start_pos . distance ( input. mouse . position ) <= DRAG_THRESHOLD {
793+ shape_editor. flip_smooth_sharp ( & document. network_interface , input. mouse . position , SELECTION_TOLERANCE , responses) ;
794+ responses. add ( PathToolMessage :: SelectedPointUpdated ) ;
795+ }
796+
797+ return PathToolFsmState :: Ready ;
780798 }
781- self
799+
800+ // Double-clicked on a filled region
801+ if let Some ( layer) = document. click ( input) {
802+ // Select all points in the layer
803+ shape_editor. select_connected_anchors ( document, layer, input. mouse . position ) ;
804+ }
805+
806+ PathToolFsmState :: Ready
782807 }
783808 ( _, PathToolMessage :: Abort ) => {
784809 responses. add ( OverlaysMessage :: Draw ) ;
0 commit comments