Skip to content

Commit bde8d04

Browse files
delete
1 parent 70d63af commit bde8d04

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/renderer/app_state.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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,

src/renderer/shape.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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)]

0 commit comments

Comments
 (0)