center the view of a GraphEdit on a GraphNode

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By patatra

Hye,

Does the graphnode have a function to center its view on a graphnode? I try to do it with script but I don’t understand well the zoom.

var pos_node = start_node.get_position()
var size_node = start_node.get_size()
var viewport_size = _graph.get_viewport_rect().size
_graph.scroll_offset = (pos_node + (size_node-viewport_size)/2)/_graph.zoom

Good Day,