@@ -105,6 +105,7 @@ pub enum ShapeToolMessage {
105105 PointerOutsideViewport { modifier : ShapeToolModifierKey } ,
106106 UpdateOptions { options : ShapeOptionsUpdate } ,
107107 SetShape { shape : ShapeType } ,
108+ SyncShapeWithOptions ,
108109
109110 IncreaseSides ,
110111 DecreaseSides ,
@@ -180,30 +181,12 @@ fn create_shape_option_widget(shape_type: ShapeType) -> WidgetInstance {
180181 }
181182 . into( )
182183 } ) ,
183- MenuListEntry :: new( "Rectangle" ) . label( "Rectangle" ) . on_commit( move |_| {
184- ShapeToolMessage :: UpdateOptions {
185- options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Rectangle ) ,
186- }
187- . into( )
188- } ) ,
189- MenuListEntry :: new( "Ellipse" ) . label( "Ellipse" ) . on_commit( move |_| {
190- ShapeToolMessage :: UpdateOptions {
191- options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Ellipse ) ,
192- }
193- . into( )
194- } ) ,
195184 MenuListEntry :: new( "Arrow" ) . label( "Arrow" ) . on_commit( move |_| {
196185 ShapeToolMessage :: UpdateOptions {
197186 options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Arrow ) ,
198187 }
199188 . into( )
200189 } ) ,
201- MenuListEntry :: new( "Line" ) . label( "Line" ) . on_commit( move |_| {
202- ShapeToolMessage :: UpdateOptions {
203- options: ShapeOptionsUpdate :: ShapeType ( ShapeType :: Line ) ,
204- }
205- . into( )
206- } ) ,
207190 ] ] ;
208191 DropdownInput :: new ( entries) . selected_index ( Some ( shape_type as u32 ) ) . widget_instance ( )
209192}
@@ -1183,15 +1166,16 @@ impl Fsm for ShapeToolFsmState {
11831166 responses. add ( DocumentMessage :: AbortTransaction ) ;
11841167 tool_data. data . cleanup ( responses) ;
11851168 tool_data. current_shape = shape;
1186- responses. add ( ShapeToolMessage :: UpdateOptions {
1187- options : ShapeOptionsUpdate :: ShapeType ( shape) ,
1188- } ) ;
1189-
1190- responses. add ( ShapeToolMessage :: UpdateOptions {
1191- options : ShapeOptionsUpdate :: ShapeType ( shape) ,
1192- } ) ;
1169+ // Update hints for the new shape (without updating options.shape_type)
1170+ update_dynamic_hints ( & ShapeToolFsmState :: Ready ( shape) , responses, tool_data) ;
11931171 ShapeToolFsmState :: Ready ( shape)
11941172 }
1173+ ( _, ShapeToolMessage :: SyncShapeWithOptions ) => {
1174+ // Sync current_shape with the dropdown selection when returning from alias tools
1175+ tool_data. current_shape = tool_options. shape_type ;
1176+ update_dynamic_hints ( & ShapeToolFsmState :: Ready ( tool_options. shape_type ) , responses, tool_data) ;
1177+ ShapeToolFsmState :: Ready ( tool_options. shape_type )
1178+ }
11951179 ( _, ShapeToolMessage :: HideShapeTypeWidget { hide } ) => {
11961180 tool_data. hide_shape_option_widget = hide;
11971181 responses. add ( ToolMessage :: RefreshToolOptions ) ;
0 commit comments