Skip to content

Commit 1f7a918

Browse files
adamgerhantKeavon
andauthored
Improve the speed of SVG importing due to node positioning (#2625)
Fix slow svg import Co-authored-by: Keavon Chambers <[email protected]>
1 parent 0a65e57 commit 1f7a918

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

editor/src/messages/portfolio/document/graph_operation/graph_operation_message_handler.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::messages::portfolio::document::utility_types::document_metadata::Laye
55
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeNetworkInterface, OutputConnector};
66
use crate::messages::portfolio::document::utility_types::nodes::CollapsedLayers;
77
use crate::messages::prelude::*;
8-
use glam::{DAffine2, DVec2};
8+
use glam::{DAffine2, DVec2, IVec2};
99
use graph_craft::document::{NodeId, NodeInput};
1010
use graphene_core::Color;
1111
use graphene_core::renderer::Quad;
@@ -330,6 +330,9 @@ fn import_usvg_node(modify_inputs: &mut ModifyInputsContext, node: &usvg::Node,
330330
let layer = modify_inputs.create_layer(id);
331331
modify_inputs.network_interface.move_layer_to_stack(layer, parent, insert_index, &[]);
332332
modify_inputs.layer_node = Some(layer);
333+
if let Some(upstream_layer) = layer.next_sibling(modify_inputs.network_interface.document_metadata()) {
334+
modify_inputs.network_interface.shift_node(&upstream_layer.to_node(), IVec2::new(0, 3), &[]);
335+
}
333336
match node {
334337
usvg::Node::Group(group) => {
335338
for child in group.children() {

0 commit comments

Comments
 (0)