Skip to content

Commit ae79e52

Browse files
Temp: move table
1 parent 5ced2c2 commit ae79e52

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/renderer/app_state.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ impl<'a> AppState<'a> {
184184
self.size.height,
185185
)
186186
{
187+
println!("pressed");
188+
self.revision_stack.move_shape(shape_id, orig_coord);
189+
187190
// Found a circle - select it and start dragging
188191
self.mouse_state.set_selected_shape(Some(circle_index));
189192
self.mouse_state.set_dragging_shape(true);
@@ -214,6 +217,7 @@ impl<'a> AppState<'a> {
214217
}
215218
}
216219
(true, false) => {
220+
println!("stopped");
217221
// Mouse release - stop dragging
218222
self.mouse_state.set_dragging_shape(false);
219223
}

src/renderer/shape.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
pub enum Action {
44
Move {
55
shape_id: usize,
6-
orig_x: f32,
7-
orig_y: f32,
6+
orig_coord: Coordinate,
87
},
98
Draw {
109
shape_id: usize,
@@ -27,6 +26,13 @@ impl RevisionStack {
2726
self.stack.push(Action::Draw { shape_id: id });
2827
}
2928

29+
pub fn move_shape(&mut self, shape_id: usize, orig_coord: Coordinate) {
30+
self.stack.push(Action::Move {
31+
shape_id,
32+
orig_coord,
33+
})
34+
}
35+
3036
pub fn undo(&mut self) {
3137
if let Some(last_action) = self.stack.last() {
3238
match last_action {

0 commit comments

Comments
 (0)