fix scroll offset not loading (#114)

closes #77

Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/114
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
This commit is contained in:
Lera Elvoé 2024-03-16 09:02:19 +00:00 committed by yagich
parent d5550be77d
commit 822abb3d66

View file

@ -126,13 +126,13 @@ func get_node_renderer(node: DeckNode) -> DeckNodeRendererGraphNode:
func _on_scroll_offset_changed(offset: Vector2) -> void: func _on_scroll_offset_changed(offset: Vector2) -> void:
deck.set_meta("offset", offset) deck.set_meta("offset", offset)
## Setups all the data from the set [member deck] in this [DeckRendererGraphEdit] ## Setups all the data from the set [member deck] in this [DeckRendererGraphEdit]
func initialize_from_deck() -> void: func initialize_from_deck() -> void:
change_dirty = false change_dirty = false
for i in get_children(): for i in get_children():
i.queue_free() i.queue_free()
scroll_offset = deck.get_meta("offset", Vector2())
is_group = deck.is_group is_group = deck.is_group
for node_id in deck.nodes: for node_id in deck.nodes:
var node_renderer: DeckNodeRendererGraphNode = NODE_SCENE.instantiate() var node_renderer: DeckNodeRendererGraphNode = NODE_SCENE.instantiate()
@ -143,6 +143,10 @@ func initialize_from_deck() -> void:
dirty = false dirty = false
refresh_connections() 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 ## Loops through all [DeckNode]s in [member Deck.nodes] and calls
## [method GraphEdit.connect_node] for all the connections that exist in each ## [method GraphEdit.connect_node] for all the connections that exist in each