@@ -9,6 +9,7 @@ use crate::messages::tool::common_functionality::gizmos::gizmo_manager::GizmoMan
99use crate :: messages:: tool:: common_functionality:: graph_modification_utils;
1010use crate :: messages:: tool:: common_functionality:: resize:: Resize ;
1111use crate :: messages:: tool:: common_functionality:: shapes:: arc_shape:: Arc ;
12+ use crate :: messages:: tool:: common_functionality:: shapes:: arrow_shape:: Arrow ;
1213use crate :: messages:: tool:: common_functionality:: shapes:: circle_shape:: Circle ;
1314use crate :: messages:: tool:: common_functionality:: shapes:: grid_shape:: Grid ;
1415use crate :: messages:: tool:: common_functionality:: shapes:: line_shape:: { LineToolData , clicked_on_line_endpoints} ;
@@ -168,6 +169,30 @@ fn create_shape_option_widget(shape_type: ShapeType) -> WidgetHolder {
168169 }
169170 . into( )
170171 } ) ,
172+ MenuListEntry :: new( "Rectangle" ) . label( "Rectangle" ) . on_commit( move |_| {
173+ ShapeToolMessage :: UpdateOptions {
174+ options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Rectangle ) ,
175+ }
176+ . into( )
177+ } ) ,
178+ MenuListEntry :: new( "Ellipse" ) . label( "Ellipse" ) . on_commit( move |_| {
179+ ShapeToolMessage :: UpdateOptions {
180+ options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Ellipse ) ,
181+ }
182+ . into( )
183+ } ) ,
184+ MenuListEntry :: new( "Arrow" ) . label( "Arrow" ) . on_commit( move |_| {
185+ ShapeToolMessage :: UpdateOptions {
186+ options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Arrow ) ,
187+ }
188+ . into( )
189+ } ) ,
190+ MenuListEntry :: new( "Line" ) . label( "Line" ) . on_commit( move |_| {
191+ ShapeToolMessage :: UpdateOptions {
192+ options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Line ) ,
193+ }
194+ . into( )
195+ } ) ,
171196 ] ] ;
172197 DropdownInput :: new ( entries) . selected_index ( Some ( shape_type as u32 ) ) . widget_holder ( )
173198}
@@ -805,7 +830,7 @@ impl Fsm for ShapeToolFsmState {
805830 } ;
806831
807832 match tool_data. current_shape {
808- ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse => {
833+ ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse | ShapeType :: Arrow => {
809834 tool_data. data . start ( document, input)
810835 }
811836 ShapeType :: Line => {
@@ -822,6 +847,7 @@ impl Fsm for ShapeToolFsmState {
822847 ShapeType :: Star => Star :: create_node ( tool_options. vertices ) ,
823848 ShapeType :: Circle => Circle :: create_node ( ) ,
824849 ShapeType :: Arc => Arc :: create_node ( tool_options. arc_type ) ,
850+ ShapeType :: Arrow => Arrow :: create_node ( ) ,
825851 ShapeType :: Spiral => Spiral :: create_node ( tool_options. spiral_type , tool_options. turns ) ,
826852 ShapeType :: Grid => Grid :: create_node ( tool_options. grid_type ) ,
827853 ShapeType :: Rectangle => Rectangle :: create_node ( ) ,
@@ -835,7 +861,7 @@ impl Fsm for ShapeToolFsmState {
835861 let defered_responses = & mut VecDeque :: new ( ) ;
836862
837863 match tool_data. current_shape {
838- ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse => {
864+ ShapeType :: Arrow | ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse => {
839865 defered_responses. add ( GraphOperationMessage :: TransformSet {
840866 layer,
841867 transform : DAffine2 :: from_scale_angle_translation ( DVec2 :: ONE , 0. , input. mouse . position ) ,
@@ -872,6 +898,7 @@ impl Fsm for ShapeToolFsmState {
872898 ShapeType :: Star => Star :: update_shape ( document, input, layer, tool_data, modifier, responses) ,
873899 ShapeType :: Circle => Circle :: update_shape ( document, input, layer, tool_data, modifier, responses) ,
874900 ShapeType :: Arc => Arc :: update_shape ( document, input, layer, tool_data, modifier, responses) ,
901+ ShapeType :: Arrow => Arrow :: update_shape ( document, input, layer, tool_data, modifier, responses) ,
875902 ShapeType :: Spiral => Spiral :: update_shape ( document, input, layer, tool_data, responses) ,
876903 ShapeType :: Grid => Grid :: update_shape ( document, input, layer, tool_options. grid_type , tool_data, modifier, responses) ,
877904 ShapeType :: Rectangle => Rectangle :: update_shape ( document, input, layer, tool_data, modifier, responses) ,
@@ -1127,6 +1154,7 @@ fn update_dynamic_hints(state: &ShapeToolFsmState, responses: &mut VecDeque<Mess
11271154 HintInfo :: keys( [ Key :: Shift ] , "Constrain Regular" ) . prepend_plus( ) ,
11281155 HintInfo :: keys( [ Key :: Alt ] , "From Center" ) . prepend_plus( ) ,
11291156 ] ) ] ,
1157+ ShapeType :: Arrow => vec ! [ HintGroup ( vec![ HintInfo :: mouse( MouseMotion :: LmbDrag , "Draw Arrow" ) ] ) ] ,
11301158 } ;
11311159 HintData ( hint_groups)
11321160 }
@@ -1142,6 +1170,7 @@ fn update_dynamic_hints(state: &ShapeToolFsmState, responses: &mut VecDeque<Mess
11421170 HintInfo :: keys( [ Key :: Alt ] , "From Center" ) ,
11431171 HintInfo :: keys( [ Key :: Control ] , "Lock Angle" ) ,
11441172 ] ) ,
1173+ ShapeType :: Arrow => HintGroup ( vec ! [ HintInfo :: keys( [ Key :: Shift ] , "Constrain Angle" ) ] ) ,
11451174 ShapeType :: Circle => HintGroup ( vec ! [ HintInfo :: keys( [ Key :: Alt ] , "From Center" ) ] ) ,
11461175 ShapeType :: Spiral => HintGroup ( vec ! [ ] ) ,
11471176 } ;
0 commit comments