From 822abb3d6620260363e091e6dd06d8a991f0ae62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Sat, 16 Mar 2024 09:02:19 +0000 Subject: [PATCH] fix scroll offset not loading (#114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #77 Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/114 Co-authored-by: Lera ElvoƩ Co-committed-by: Lera ElvoƩ --- graph_node_renderer/deck_renderer_graph_edit.gd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graph_node_renderer/deck_renderer_graph_edit.gd b/graph_node_renderer/deck_renderer_graph_edit.gd index 99d0103..39ab6c3 100644 --- a/graph_node_renderer/deck_renderer_graph_edit.gd +++ b/graph_node_renderer/deck_renderer_graph_edit.gd @@ -126,13 +126,13 @@ func get_node_renderer(node: DeckNode) -> DeckNodeRendererGraphNode: func _on_scroll_offset_changed(offset: Vector2) -> void: deck.set_meta("offset", offset) + ## Setups all the data from the set [member deck] in this [DeckRendererGraphEdit] func initialize_from_deck() -> void: change_dirty = false for i in get_children(): i.queue_free() - scroll_offset = deck.get_meta("offset", Vector2()) is_group = deck.is_group for node_id in deck.nodes: var node_renderer: DeckNodeRendererGraphNode = NODE_SCENE.instantiate() @@ -143,6 +143,10 @@ func initialize_from_deck() -> void: dirty = false refresh_connections() + + var ofs = deck.get_meta("offset", Vector2()) + set_scroll_offset.call_deferred(ofs) + ## Loops through all [DeckNode]s in [member Deck.nodes] and calls ## [method GraphEdit.connect_node] for all the connections that exist in each