Fix issue when extending existing paths Co-authored-by: Starklosch <45690579+Starklosch@users.noreply.github.com>
This commit is contained in:
parent
c486c6e3e3
commit
a6d3c06641
|
|
@ -316,6 +316,7 @@ struct PenToolData {
|
||||||
|
|
||||||
snap_cache: SnapCache,
|
snap_cache: SnapCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PenToolData {
|
impl PenToolData {
|
||||||
fn latest_point(&self) -> Option<&LastPoint> {
|
fn latest_point(&self) -> Option<&LastPoint> {
|
||||||
self.latest_points.get(self.point_index)
|
self.latest_points.get(self.point_index)
|
||||||
|
|
@ -1601,7 +1602,12 @@ impl Fsm for PenToolFsmState {
|
||||||
PenToolFsmState::Ready
|
PenToolFsmState::Ready
|
||||||
}
|
}
|
||||||
(_, PenToolMessage::Abort) => {
|
(_, PenToolMessage::Abort) => {
|
||||||
let should_delete_layer = tool_data.latest_points.len() == 1;
|
let should_delete_layer = if layer.is_some() {
|
||||||
|
let vector_data = document.network_interface.compute_modified_vector(layer.unwrap()).unwrap();
|
||||||
|
vector_data.point_domain.ids().len() == 1
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
responses.add(DocumentMessage::AbortTransaction);
|
responses.add(DocumentMessage::AbortTransaction);
|
||||||
tool_data.handle_end = None;
|
tool_data.handle_end = None;
|
||||||
|
|
@ -1610,7 +1616,7 @@ impl Fsm for PenToolFsmState {
|
||||||
tool_data.draw_mode = DrawMode::BreakPath;
|
tool_data.draw_mode = DrawMode::BreakPath;
|
||||||
tool_data.snap_manager.cleanup(responses);
|
tool_data.snap_manager.cleanup(responses);
|
||||||
|
|
||||||
if should_delete_layer && layer.is_some() {
|
if should_delete_layer {
|
||||||
responses.add(NodeGraphMessage::DeleteNodes {
|
responses.add(NodeGraphMessage::DeleteNodes {
|
||||||
node_ids: vec![layer.unwrap().to_node()],
|
node_ids: vec![layer.unwrap().to_node()],
|
||||||
delete_children: true,
|
delete_children: true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue