Automatically place layers into the artboard they're drawn inside of (#2110)

* place new layer from basic tools within an artboard bounds

Signed-off-by: James Ryans <james.ryans2012@gmail.com>

* add for Text Tool

Signed-off-by: James Ryans <james.ryans2012@gmail.com>

* use click_xray function

Signed-off-by: James Ryans <james.ryans2012@gmail.com>

* support for freehand tool

Signed-off-by: James Ryans <james.ryans2012@gmail.com>

* support spline tool

Signed-off-by: James Ryans <james.ryans2012@gmail.com>

---------

Signed-off-by: James Ryans <james.ryans2012@gmail.com>
This commit is contained in:
James Ryans
2024-12-20 19:02:00 -08:00
committed by GitHub
parent 337b8bad13
commit 3be7505faf
9 changed files with 16 additions and 8 deletions
@@ -1652,6 +1652,14 @@ impl DocumentMessageHandler {
}
}
/// Finds the artboard that bounds the point in viewport space and be the container of any newly added layers.
pub fn new_layer_bounding_artboard(&self, ipp: &InputPreprocessorMessageHandler) -> LayerNodeIdentifier {
self.click_xray(ipp)
.filter(|layer| self.network_interface.is_artboard(&layer.to_node(), &[]))
.next()
.unwrap_or(LayerNodeIdentifier::ROOT_PARENT)
}
/// Finds the parent folder which, based on the current selections, should be the container of any newly added layers.
pub fn new_layer_parent(&self, include_self: bool) -> LayerNodeIdentifier {
self.network_interface