Make the Pen tool only append new paths when Shift is held (#2102)

* Append to a path with shift

* Fixup transforms

* Revert unnecessary transform change

* Fix delete node button transaction

* Prevent artboard from being selected after making a new document

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
James Lindsay
2024-11-11 15:14:32 -08:00
committed by GitHub
co-authored by Keavon Chambers
parent d649052255
commit 3ce1317053
6 changed files with 192 additions and 150 deletions
@@ -338,6 +338,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
responses.add(NodeGraphMessage::RunDocumentGraph);
responses.add(NodeGraphMessage::SelectedNodesUpdated);
responses.add(NodeGraphMessage::SendGraph);
responses.add(DocumentMessage::EndTransaction);
}
DocumentMessage::DeleteSelectedLayers => {
responses.add(NodeGraphMessage::DeleteSelectedNodes { delete_children: true });
@@ -1279,7 +1280,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
layer: node_layer_id,
transform: DAffine2::from_translation(bounds_rounded_dimensions / 2.),
transform_in: TransformIn::Local,
skip_rerender: true,
skip_rerender: false,
});
}
DocumentMessage::ZoomCanvasTo100Percent => {
@@ -1297,6 +1298,8 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
if let Some(bounds) = bounds {
responses.add(NavigationMessage::CanvasTiltSet { angle_radians: 0. });
responses.add(NavigationMessage::FitViewportToBounds { bounds, prevent_zoom_past_100: true });
} else {
warn!("Cannot zoom due to no bounds")
}
}
DocumentMessage::Noop => (),
@@ -321,6 +321,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageData<'_>> for Navigation
let diagonal = pos2 - pos1;
if diagonal.length() < f64::EPSILON * 1000. || ipp.viewport_bounds.size() == DVec2::ZERO {
warn!("Cannot center since the viewport size is 0");
return;
}