@@ -14,6 +14,7 @@ use crate::messages::tool::common_functionality::shapes::circle_shape::Circle;
1414use crate :: messages:: tool:: common_functionality:: shapes:: grid_shape:: Grid ;
1515use crate :: messages:: tool:: common_functionality:: shapes:: line_shape:: LineToolData ;
1616use crate :: messages:: tool:: common_functionality:: shapes:: polygon_shape:: Polygon ;
17+ use crate :: messages:: tool:: common_functionality:: shapes:: qr_code_shape:: QrCode ;
1718use crate :: messages:: tool:: common_functionality:: shapes:: shape_utility:: { ShapeToolModifierKey , ShapeType , anchor_overlays, clicked_on_shape_endpoints, transform_cage_overlays} ;
1819use crate :: messages:: tool:: common_functionality:: shapes:: spiral_shape:: Spiral ;
1920use crate :: messages:: tool:: common_functionality:: shapes:: star_shape:: Star ;
@@ -187,6 +188,12 @@ fn create_shape_option_widget(shape_type: ShapeType) -> WidgetInstance {
187188 }
188189 . into( )
189190 } ) ,
191+ MenuListEntry :: new( "QR Code" ) . label( "QR Code" ) . on_commit( move |_| {
192+ ShapeToolMessage :: UpdateOptions {
193+ options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: QrCode ) ,
194+ }
195+ . into( )
196+ } ) ,
190197 ] ] ;
191198 DropdownInput :: new ( entries) . selected_index ( Some ( shape_type as u32 ) ) . widget_instance ( )
192199}
@@ -905,7 +912,7 @@ impl Fsm for ShapeToolFsmState {
905912 } ;
906913
907914 match tool_data. current_shape {
908- ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse => {
915+ ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse | ShapeType :: QrCode => {
909916 tool_data. data . start ( document, input, viewport) ;
910917 }
911918 ShapeType :: Arrow | ShapeType :: Line => {
@@ -931,6 +938,7 @@ impl Fsm for ShapeToolFsmState {
931938 ShapeType :: Line => Line :: create_node ( ) ,
932939 ShapeType :: Rectangle => Rectangle :: create_node ( ) ,
933940 ShapeType :: Ellipse => Ellipse :: create_node ( ) ,
941+ ShapeType :: QrCode => QrCode :: create_node ( ) ,
934942 } ;
935943
936944 let nodes = vec ! [ ( NodeId ( 0 ) , node) ] ;
@@ -939,7 +947,7 @@ impl Fsm for ShapeToolFsmState {
939947 let defered_responses = & mut VecDeque :: new ( ) ;
940948
941949 match tool_data. current_shape {
942- ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse => {
950+ ShapeType :: Polygon | ShapeType :: Star | ShapeType :: Circle | ShapeType :: Arc | ShapeType :: Spiral | ShapeType :: Grid | ShapeType :: Rectangle | ShapeType :: Ellipse | ShapeType :: QrCode => {
943951 defered_responses. add ( GraphOperationMessage :: TransformSet {
944952 layer,
945953 transform : DAffine2 :: from_scale_angle_translation ( DVec2 :: ONE , 0. , input. mouse . position ) ,
@@ -1004,6 +1012,7 @@ impl Fsm for ShapeToolFsmState {
10041012 ShapeType :: Line => Line :: update_shape ( document, input, viewport, layer, tool_data, modifier, responses) ,
10051013 ShapeType :: Rectangle => Rectangle :: update_shape ( document, input, viewport, layer, tool_data, modifier, responses) ,
10061014 ShapeType :: Ellipse => Ellipse :: update_shape ( document, input, viewport, layer, tool_data, modifier, responses) ,
1015+ ShapeType :: QrCode => QrCode :: update_shape ( document, input, viewport, layer, tool_data, modifier, responses) ,
10071016 }
10081017
10091018 // Auto-panning
@@ -1269,6 +1278,10 @@ fn update_dynamic_hints(state: &ShapeToolFsmState, responses: &mut VecDeque<Mess
12691278 HintInfo :: keys( [ Key :: Shift ] , "Constrain Circular" ) . prepend_plus( ) ,
12701279 HintInfo :: keys( [ Key :: Alt ] , "From Center" ) . prepend_plus( ) ,
12711280 ] ) ] ,
1281+ ShapeType :: QrCode => vec ! [ HintGroup ( vec![
1282+ HintInfo :: mouse( MouseMotion :: LmbDrag , "Draw QR Code" ) ,
1283+ HintInfo :: keys( [ Key :: Alt ] , "From Center" ) . prepend_plus( ) ,
1284+ ] ) ] ,
12721285 } ;
12731286 HintData ( hint_groups)
12741287 }
@@ -1291,6 +1304,7 @@ fn update_dynamic_hints(state: &ShapeToolFsmState, responses: &mut VecDeque<Mess
12911304 ] ) ,
12921305 ShapeType :: Rectangle => HintGroup ( vec ! [ HintInfo :: keys( [ Key :: Shift ] , "Constrain Square" ) , HintInfo :: keys( [ Key :: Alt ] , "From Center" ) ] ) ,
12931306 ShapeType :: Ellipse => HintGroup ( vec ! [ HintInfo :: keys( [ Key :: Shift ] , "Constrain Circular" ) , HintInfo :: keys( [ Key :: Alt ] , "From Center" ) ] ) ,
1307+ ShapeType :: QrCode => HintGroup ( vec ! [ HintInfo :: keys( [ Key :: Alt ] , "From Center" ) ] ) ,
12941308 } ;
12951309
12961310 if !tool_hint_group. 0 . is_empty ( ) {
0 commit comments