File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -297,6 +297,14 @@ impl<'a> AppState<'a> {
297297 ( KeyCode :: KeyY , ElementState :: Pressed ) => {
298298 feature_uniform. apply_transform ( TransformAction :: FlipY ) ;
299299 }
300+ ( KeyCode :: Delete , ElementState :: Pressed ) | ( KeyCode :: Backspace , ElementState :: Pressed ) => {
301+ // Delete the selected circle
302+ if let Some ( selected_index) = self . mouse_state . selected_circle ( ) {
303+ self . shape_stack . remove_circle ( selected_index) ;
304+ self . mouse_state . set_selected_circle ( None ) ;
305+ self . mouse_state . set_dragging_circle ( false ) ;
306+ }
307+ }
300308 _ => return false ,
301309 } ,
302310 _ => return false ,
Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ impl ShapeStack {
3737 * y = new_y;
3838 }
3939 }
40+
41+ // Remove a circle by index
42+ pub fn remove_circle ( & mut self , index : usize ) {
43+ if index < self . shapes . len ( ) {
44+ self . shapes . remove ( index) ;
45+ }
46+ }
4047}
4148
4249#[ allow( dead_code) ]
You can’t perform that action at this time.
0 commit comments