Skip to content

Commit

Permalink
Reorder arms of text tool FSM
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitish-bot committed Jan 2, 2025
1 parent 984dee1 commit 41ee2f5
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions editor/src/messages/tool/tool_messages/text_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,24 +474,6 @@ impl Fsm for TextToolFsmState {

state
}
(TextToolFsmState::Editing, TextToolMessage::Abort) => {
if tool_data.new_text.is_empty() {
return tool_data.delete_empty_layer(font_cache, responses);
}

responses.add(FrontendMessage::TriggerTextCommit);
TextToolFsmState::Editing
}
(state, TextToolMessage::Abort) => {
input.mouse.finish_transaction(tool_data.resize.viewport_drag_start(document), responses);
tool_data.resize.cleanup(responses);

if state == TextToolFsmState::Editing {
tool_data.set_editing(false, font_cache, responses);
}

TextToolFsmState::Ready
}
(TextToolFsmState::Ready, TextToolMessage::DragStart) => {
tool_data.resize.start(document, input);
tool_data.cached_resize_bounds = [tool_data.resize.viewport_drag_start(document); 2];
Expand Down Expand Up @@ -598,6 +580,24 @@ impl Fsm for TextToolFsmState {
)));
self
}
(TextToolFsmState::Editing, TextToolMessage::Abort) => {
if tool_data.new_text.is_empty() {
return tool_data.delete_empty_layer(font_cache, responses);
}

responses.add(FrontendMessage::TriggerTextCommit);
TextToolFsmState::Editing
}
(state, TextToolMessage::Abort) => {
input.mouse.finish_transaction(tool_data.resize.viewport_drag_start(document), responses);
tool_data.resize.cleanup(responses);

if state == TextToolFsmState::Editing {
tool_data.set_editing(false, font_cache, responses);
}

TextToolFsmState::Ready
}
_ => self,
}
}
Expand Down

0 comments on commit 41ee2f5

Please sign in to comment.