Skip to content

Commit

Permalink
Fix penfsm not clearing resources and returing to ready when aborting
Browse files Browse the repository at this point in the history
  • Loading branch information
mTvare6 authored and Keavon committed Jan 29, 2025
1 parent eb0ff20 commit 8b37915
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions editor/src/messages/tool/tool_messages/pen_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ impl PenToolData {
},
});
}
responses.add(DocumentMessage::EndTransaction);
if !close_subpath {
self.add_point(LastPoint {
id: end,
Expand All @@ -348,6 +347,7 @@ impl PenToolData {
handle_start: next_handle_start,
});
}
responses.add(DocumentMessage::EndTransaction);
Some(if close_subpath { PenToolFsmState::Ready } else { PenToolFsmState::PlacingAnchor })
}

Expand Down Expand Up @@ -857,10 +857,14 @@ impl Fsm for PenToolFsmState {
}
(_, PenToolMessage::Abort) => {
responses.add(DocumentMessage::AbortTransaction);
tool_data.handle_end = None;
tool_data.latest_points.clear();
tool_data.point_index = 0;
tool_data.snap_manager.cleanup(responses);

responses.add(OverlaysMessage::Draw);

self
PenToolFsmState::Ready
}
(PenToolFsmState::DraggingHandle | PenToolFsmState::PlacingAnchor, PenToolMessage::Undo) => {
if tool_data.point_index > 0 {
Expand Down

0 comments on commit 8b37915

Please sign in to comment.