@@ -16,7 +16,7 @@ use crate::messages::tool::common_functionality::shape_editor::{
16
16
} ;
17
17
use crate :: messages:: tool:: common_functionality:: snapping:: { SnapCache , SnapCandidatePoint , SnapConstraint , SnapData , SnapManager } ;
18
18
use crate :: messages:: tool:: common_functionality:: utility_functions:: { calculate_segment_angle, find_two_param_best_approximate} ;
19
- use bezier_rs:: { Bezier , TValue } ;
19
+ use bezier_rs:: { Bezier , BezierHandles , TValue } ;
20
20
use graphene_std:: renderer:: Quad ;
21
21
use graphene_std:: vector:: { HandleExt , HandleId , NoHashBuilder , SegmentId , VectorData } ;
22
22
use graphene_std:: vector:: { ManipulatorPointId , PointId , VectorModificationType } ;
@@ -674,13 +674,15 @@ impl PathToolData {
674
674
responses. add ( OverlaysMessage :: Draw ) ;
675
675
PathToolFsmState :: Dragging ( self . dragging_state )
676
676
} else {
677
- let handle1 = ManipulatorPointId :: PrimaryHandle ( segment. segment ( ) ) ;
678
- let handle2 = ManipulatorPointId :: EndHandle ( segment. segment ( ) ) ;
679
- if let Some ( vector_data) = document. network_interface . compute_modified_vector ( segment. layer ( ) ) {
680
- if let ( Some ( pos1) , Some ( pos2) ) = ( handle1. get_position ( & vector_data) , handle2. get_position ( & vector_data) ) {
681
- self . molding_info = Some ( ( pos1, pos2) )
682
- }
683
- }
677
+ let start_pos = segment. bezier ( ) . start ;
678
+ let end_pos = segment. bezier ( ) . end ;
679
+
680
+ let [ pos1, pos2] = match segment. bezier ( ) . handles {
681
+ BezierHandles :: Cubic { handle_start, handle_end } => [ handle_start, handle_end] ,
682
+ BezierHandles :: Quadratic { handle } => [ handle, end_pos] ,
683
+ BezierHandles :: Linear => [ start_pos + ( end_pos - start_pos) / 3. , end_pos + ( start_pos - end_pos) / 3. ] ,
684
+ } ;
685
+ self . molding_info = Some ( ( pos1, pos2) ) ;
684
686
PathToolFsmState :: Dragging ( self . dragging_state )
685
687
}
686
688
}
0 commit comments