Description
The CenterOnSelection
method is a public instance method of the GraphView
class within the Editor.NodeEditor
namespace. This method is used to adjust the view of the graph editor so that the currently selected nodes are centered within the visible area of the editor. This can be particularly useful for quickly navigating to and focusing on specific nodes within a complex graph.
Usage
To use the CenterOnSelection
method, ensure that you have a valid instance of GraphView
and that there are nodes currently selected in the graph. Simply call the method on the instance to center the view on the selected nodes.
Example
// Assuming 'graphView' is an instance of Editor.NodeEditor.GraphView
// Center the view on the currently selected nodes
graphView.CenterOnSelection();