Skip to content

Commit

Permalink
fix regression of undo + redo
Browse files Browse the repository at this point in the history
e3f01e2 clears `delta_accumulator` before pushing the change to history, so the history.
  • Loading branch information
justDeeevin committed Mar 26, 2024
1 parent 81d446d commit f057ffc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ui/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,15 @@ impl canvas::Program<Message> for NuhxBoard {
}
mouse::Event::ButtonReleased(mouse::Button::Left) => {
let message = if state.delta_accumulator != Coord::default() {
state.delta_accumulator = Coord::default();
state.selected_element = state.held_element;
state.held_element.map(|index| {
let out = state.held_element.map(|index| {
Message::PushChange(Change::MoveElement {
index,
delta: state.delta_accumulator,
})
})
});
state.delta_accumulator = Coord::default();
state.selected_element = state.held_element;
out
} else {
state.selected_element = state.hovered_element;
None
Expand Down

0 comments on commit f057ffc

Please sign in to comment.