File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
editor/src/messages/portfolio/document Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1654,9 +1654,18 @@ impl DocumentMessageHandler {
16541654
16551655 /// Finds the artboard that bounds the point in viewport space and be the container of any newly added layers.
16561656 pub fn new_layer_bounding_artboard ( & self , ipp : & InputPreprocessorMessageHandler ) -> LayerNodeIdentifier {
1657- self . click_xray ( ipp)
1657+ let container_based_on_selection = self . new_layer_parent ( true ) ;
1658+
1659+ let container_based_on_clicked_artboard = self
1660+ . click_xray ( ipp)
16581661 . find ( |layer| self . network_interface . is_artboard ( & layer. to_node ( ) , & [ ] ) )
1659- . unwrap_or ( LayerNodeIdentifier :: ROOT_PARENT )
1662+ . unwrap_or ( LayerNodeIdentifier :: ROOT_PARENT ) ;
1663+
1664+ if container_based_on_selection. ancestors ( self . metadata ( ) ) . any ( |ancestor| ancestor == container_based_on_clicked_artboard) {
1665+ container_based_on_selection
1666+ } else {
1667+ container_based_on_clicked_artboard
1668+ }
16601669 }
16611670
16621671 /// Finds the parent folder which, based on the current selections, should be the container of any newly added layers.
You can’t perform that action at this time.
0 commit comments