@@ -127,6 +127,7 @@ pub enum PathToolMessage {
127
127
UpdateSelectedPointsStatus {
128
128
overlay_context : OverlayContext ,
129
129
} ,
130
+ StartSlidingPoint ,
130
131
Copy {
131
132
clipboard : Clipboard ,
132
133
} ,
@@ -420,6 +421,7 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> for Path
420
421
DeleteAndBreakPath ,
421
422
ClosePath ,
422
423
PointerMove ,
424
+ StartSlidingPoint ,
423
425
Copy ,
424
426
Cut ,
425
427
DeleteSelected ,
@@ -438,6 +440,7 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> for Path
438
440
BreakPath ,
439
441
DeleteAndBreakPath ,
440
442
SwapSelectedHandles ,
443
+ StartSlidingPoint ,
441
444
Copy ,
442
445
Cut ,
443
446
DeleteSelected ,
@@ -456,6 +459,7 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> for Path
456
459
DeleteAndBreakPath ,
457
460
Escape ,
458
461
RightClick ,
462
+ StartSlidingPoint ,
459
463
TogglePointEditing ,
460
464
ToggleSegmentEditing
461
465
) ,
@@ -1208,11 +1212,6 @@ impl PathToolData {
1208
1212
} ;
1209
1213
let Some ( vector) = document. network_interface . compute_modified_vector ( layer) else { return false } ;
1210
1214
1211
- // Check that the handles of anchor point are also colinear
1212
- if !vector. colinear ( * anchor) {
1213
- return false ;
1214
- } ;
1215
-
1216
1215
let Some ( point_id) = anchor. as_anchor ( ) else { return false } ;
1217
1216
1218
1217
let mut connected_segments = [ None , None ] ;
@@ -2083,10 +2082,6 @@ impl Fsm for PathToolFsmState {
2083
2082
}
2084
2083
2085
2084
if !tool_data. update_colinear ( equidistant_state, toggle_colinear_state, tool_action_data. shape_editor , tool_action_data. document , responses) {
2086
- if snap_angle_state && lock_angle_state && tool_data. start_sliding_point ( tool_action_data. shape_editor , tool_action_data. document ) {
2087
- return PathToolFsmState :: SlidingPoint ;
2088
- }
2089
-
2090
2085
tool_data. drag (
2091
2086
equidistant_state,
2092
2087
lock_angle_state,
@@ -2382,6 +2377,8 @@ impl Fsm for PathToolFsmState {
2382
2377
tool_data. ghost_outline . clear ( ) ;
2383
2378
let extend_selection = input. keyboard . get ( extend_selection as usize ) ;
2384
2379
let drag_occurred = tool_data. drag_start_pos . distance ( input. mouse . position ) > DRAG_THRESHOLD ;
2380
+ let mut segment_dissolved = false ;
2381
+ let mut point_inserted = false ;
2385
2382
2386
2383
let nearest_point = shape_editor. find_nearest_visible_point_indices (
2387
2384
& document. network_interface ,
@@ -2402,6 +2399,7 @@ impl Fsm for PathToolFsmState {
2402
2399
if tool_data. delete_segment_pressed {
2403
2400
if let Some ( vector) = document. network_interface . compute_modified_vector ( segment. layer ( ) ) {
2404
2401
shape_editor. dissolve_segment ( responses, segment. layer ( ) , & vector, segment. segment ( ) , segment. points ( ) ) ;
2402
+ segment_dissolved = true ;
2405
2403
}
2406
2404
} else {
2407
2405
let is_segment_selected = shape_editor
@@ -2410,18 +2408,19 @@ impl Fsm for PathToolFsmState {
2410
2408
. is_some_and ( |state| state. is_segment_selected ( segment. segment ( ) ) ) ;
2411
2409
2412
2410
segment. adjusted_insert_and_select ( shape_editor, responses, extend_selection, point_mode, is_segment_selected) ;
2413
- tool_data. segment = None ;
2414
- tool_data. molding_info = None ;
2415
- tool_data. molding_segment = false ;
2416
- tool_data. temporary_adjacent_handles_while_molding = None ;
2417
- return PathToolFsmState :: Ready ;
2411
+ point_inserted = true ;
2418
2412
}
2419
2413
}
2420
2414
2421
2415
tool_data. segment = None ;
2422
2416
tool_data. molding_info = None ;
2423
2417
tool_data. molding_segment = false ;
2424
2418
tool_data. temporary_adjacent_handles_while_molding = None ;
2419
+
2420
+ if segment_dissolved || point_inserted {
2421
+ responses. add ( DocumentMessage :: EndTransaction ) ;
2422
+ return PathToolFsmState :: Ready ;
2423
+ }
2425
2424
}
2426
2425
2427
2426
let segment_mode = tool_options. path_editing_mode . segment_editing_mode ;
@@ -2578,6 +2577,14 @@ impl Fsm for PathToolFsmState {
2578
2577
shape_editor. delete_point_and_break_path ( document, responses) ;
2579
2578
PathToolFsmState :: Ready
2580
2579
}
2580
+ ( _, PathToolMessage :: StartSlidingPoint ) => {
2581
+ responses. add ( DocumentMessage :: StartTransaction ) ;
2582
+ if tool_data. start_sliding_point ( shape_editor, document) {
2583
+ PathToolFsmState :: SlidingPoint
2584
+ } else {
2585
+ PathToolFsmState :: Ready
2586
+ }
2587
+ }
2581
2588
( _, PathToolMessage :: Copy { clipboard } ) => {
2582
2589
// TODO: Add support for selected segments
2583
2590
@@ -3297,18 +3304,14 @@ fn update_dynamic_hints(
3297
3304
}
3298
3305
}
3299
3306
3300
- let mut drag_selected_hints = vec ! [ HintInfo :: mouse( MouseMotion :: LmbDrag , "Drag Selected" ) ] ;
3307
+ let drag_selected_hints = vec ! [ HintInfo :: mouse( MouseMotion :: LmbDrag , "Drag Selected" ) ] ;
3301
3308
let mut delete_selected_hints = vec ! [ HintInfo :: keys( [ Key :: Delete ] , "Delete Selected" ) ] ;
3302
3309
3303
3310
if at_least_one_anchor_selected {
3304
3311
delete_selected_hints. push ( HintInfo :: keys ( [ Key :: Accel ] , "No Dissolve" ) . prepend_plus ( ) ) ;
3305
3312
delete_selected_hints. push ( HintInfo :: keys ( [ Key :: Shift ] , "Cut Anchor" ) . prepend_plus ( ) ) ;
3306
3313
}
3307
3314
3308
- if single_colinear_anchor_selected {
3309
- drag_selected_hints. push ( HintInfo :: multi_keys ( [ [ Key :: Control ] , [ Key :: Shift ] ] , "Slide" ) . prepend_plus ( ) ) ;
3310
- }
3311
-
3312
3315
let segment_edit = tool_options. path_editing_mode . segment_editing_mode ;
3313
3316
let point_edit = tool_options. path_editing_mode . point_editing_mode ;
3314
3317
@@ -3373,9 +3376,15 @@ fn update_dynamic_hints(
3373
3376
let mut groups = vec ! [
3374
3377
HintGroup ( drag_selected_hints) ,
3375
3378
HintGroup ( vec![ HintInfo :: multi_keys( [ [ Key :: KeyG ] , [ Key :: KeyR ] , [ Key :: KeyS ] ] , "Grab/Rotate/Scale Selected" ) ] ) ,
3376
- HintGroup ( vec![ HintInfo :: arrow_keys( "Nudge Selected" ) , HintInfo :: keys( [ Key :: Shift ] , "10x" ) . prepend_plus( ) ] ) ,
3377
- HintGroup ( delete_selected_hints) ,
3378
3379
] ;
3380
+
3381
+ if single_colinear_anchor_selected {
3382
+ groups. push ( HintGroup ( vec ! [ HintInfo :: multi_keys( [ [ Key :: KeyG ] , [ Key :: KeyG ] ] , "Slide" ) ] ) ) ;
3383
+ }
3384
+
3385
+ groups. push ( HintGroup ( vec ! [ HintInfo :: arrow_keys( "Nudge Selected" ) , HintInfo :: keys( [ Key :: Shift ] , "10x" ) . prepend_plus( ) ] ) ) ;
3386
+ groups. push ( HintGroup ( delete_selected_hints) ) ;
3387
+
3379
3388
hint_data. append ( & mut groups) ;
3380
3389
}
3381
3390
0 commit comments