From e306b319eb3ccc89cb2422e9e051ca1af69c3728 Mon Sep 17 00:00:00 2001 From: krVatsal Date: Fri, 20 Feb 2026 12:28:19 +0530 Subject: [PATCH 1/2] fix preview line to be visible on multiple undo --- .../messages/tool/tool_messages/pen_tool.rs | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/editor/src/messages/tool/tool_messages/pen_tool.rs b/editor/src/messages/tool/tool_messages/pen_tool.rs index 599c1befd1..ccd92bd616 100644 --- a/editor/src/messages/tool/tool_messages/pen_tool.rs +++ b/editor/src/messages/tool/tool_messages/pen_tool.rs @@ -2002,7 +2002,7 @@ impl Fsm for PenToolFsmState { }; let state = tool_data .place_anchor(SnapData::new(document, input, viewport), transform, input.mouse.position, responses) - .unwrap_or(PenToolFsmState::Ready); + .unwrap_or(self); // Auto-panning let messages = [ @@ -2185,9 +2185,26 @@ impl Fsm for PenToolFsmState { (PenToolFsmState::DraggingHandle(..) | PenToolFsmState::PlacingAnchor, PenToolMessage::Undo) => { if tool_data.point_index > 0 { tool_data.point_index -= 1; - tool_data - .place_anchor(SnapData::new(document, input, viewport), transform, input.mouse.position, responses) - .unwrap_or(PenToolFsmState::PlacingAnchor) + } + + // Sync preview state so the bezier curve preview originates from the current anchor. + // Setting handle_end to Some ensures the bezier preview renders and place_anchor + // keeps handle_end/next_handle_start in sync with the mouse on subsequent moves. + if let Some(current) = tool_data.latest_points.get(tool_data.point_index) { + tool_data.next_point = current.pos; + tool_data.next_handle_start = current.pos; + tool_data.handle_end = Some(current.pos); + + // Trigger a PointerMove so the preview immediately follows the cursor + // instead of sitting at the anchor until the user moves the mouse. + responses.add(PenToolMessage::PointerMove { + snap_angle: Key::Shift, + break_handle: Key::Alt, + lock_angle: Key::Control, + colinear: Key::KeyC, + move_anchor_with_handles: Key::Space, + }); + PenToolFsmState::PlacingAnchor } else { responses.add(PenToolMessage::Abort); self From dee514912fb38dcaf5c2676a32ecb61b9362f324 Mon Sep 17 00:00:00 2001 From: krVatsal Date: Sat, 21 Feb 2026 15:57:01 +0530 Subject: [PATCH 2/2] fixed regression issue for last anchor --- .../messages/tool/tool_messages/pen_tool.rs | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/editor/src/messages/tool/tool_messages/pen_tool.rs b/editor/src/messages/tool/tool_messages/pen_tool.rs index ccd92bd616..1f570cbb49 100644 --- a/editor/src/messages/tool/tool_messages/pen_tool.rs +++ b/editor/src/messages/tool/tool_messages/pen_tool.rs @@ -2185,26 +2185,35 @@ impl Fsm for PenToolFsmState { (PenToolFsmState::DraggingHandle(..) | PenToolFsmState::PlacingAnchor, PenToolMessage::Undo) => { if tool_data.point_index > 0 { tool_data.point_index -= 1; - } - // Sync preview state so the bezier curve preview originates from the current anchor. - // Setting handle_end to Some ensures the bezier preview renders and place_anchor - // keeps handle_end/next_handle_start in sync with the mouse on subsequent moves. - if let Some(current) = tool_data.latest_points.get(tool_data.point_index) { - tool_data.next_point = current.pos; - tool_data.next_handle_start = current.pos; - tool_data.handle_end = Some(current.pos); - - // Trigger a PointerMove so the preview immediately follows the cursor - // instead of sitting at the anchor until the user moves the mouse. - responses.add(PenToolMessage::PointerMove { - snap_angle: Key::Shift, - break_handle: Key::Alt, - lock_angle: Key::Control, - colinear: Key::KeyC, - move_anchor_with_handles: Key::Space, - }); - PenToolFsmState::PlacingAnchor + if tool_data.point_index > 0 { + tool_data + .place_anchor(SnapData::new(document, input, viewport), transform, input.mouse.position, responses) + .unwrap_or(PenToolFsmState::PlacingAnchor); + } + + // Sync preview state so the bezier curve preview originates from the current anchor. + // Setting handle_end to Some ensures the bezier preview renders and place_anchor + // keeps handle_end/next_handle_start in sync with the mouse on subsequent moves. + if let Some(current) = tool_data.latest_points.get(tool_data.point_index) { + tool_data.next_point = current.pos; + tool_data.next_handle_start = current.pos; + tool_data.handle_end = Some(current.pos); + + // Trigger a PointerMove so the preview immediately follows the cursor + // instead of sitting at the anchor until the user moves the mouse. + responses.add(PenToolMessage::PointerMove { + snap_angle: Key::Shift, + break_handle: Key::Alt, + lock_angle: Key::Control, + colinear: Key::KeyC, + move_anchor_with_handles: Key::Space, + }); + PenToolFsmState::PlacingAnchor + } else { + responses.add(PenToolMessage::Abort); + self + } } else { responses.add(PenToolMessage::Abort); self