Fix drawing new layers not being put next to nested selected layers
A regression introduced in #2110
This commit is contained in:
parent
07601a5c6c
commit
51d1c4eeac
|
|
@ -1654,9 +1654,18 @@ impl DocumentMessageHandler {
|
||||||
|
|
||||||
/// Finds the artboard that bounds the point in viewport space and be the container of any newly added layers.
|
/// 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 {
|
pub fn new_layer_bounding_artboard(&self, ipp: &InputPreprocessorMessageHandler) -> LayerNodeIdentifier {
|
||||||
self.click_xray(ipp)
|
let container_based_on_selection = self.new_layer_parent(true);
|
||||||
|
|
||||||
|
let container_based_on_clicked_artboard = self
|
||||||
|
.click_xray(ipp)
|
||||||
.find(|layer| self.network_interface.is_artboard(&layer.to_node(), &[]))
|
.find(|layer| self.network_interface.is_artboard(&layer.to_node(), &[]))
|
||||||
.unwrap_or(LayerNodeIdentifier::ROOT_PARENT)
|
.unwrap_or(LayerNodeIdentifier::ROOT_PARENT);
|
||||||
|
|
||||||
|
if container_based_on_selection.ancestors(self.metadata()).any(|ancestor| ancestor == container_based_on_clicked_artboard) {
|
||||||
|
container_based_on_selection
|
||||||
|
} else {
|
||||||
|
container_based_on_clicked_artboard
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds the parent folder which, based on the current selections, should be the container of any newly added layers.
|
/// Finds the parent folder which, based on the current selections, should be the container of any newly added layers.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue