Class ScyllaDependencyGraphElement
Renders the Scylla module dependency graph as a native UI Toolkit
UnityEngine.UIElements.VisualElement. Absolute-positioned node child elements represent
modules; Painter2D Bezier curves with arrowheads represent dependency
edges. Supports single-node selection, tier-based layered layout, and status-color
dots per node.
Implements
Inherited Members
Namespace: Scylla.Core.Editor
Assembly: ScyllaCore.Editor.dll
Syntax
public sealed class ScyllaDependencyGraphElement : VisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle
Remarks
Visual model. The element wraps an internal ScrollView
that hosts a canvas VisualElement. Inside the canvas, two absolutely
positioned layers are stacked: _edgesLayer (drawn via
generateVisualContent, PickingMode.Ignore) sits below
_nodesLayer, which contains one node element per module. The
canvas size is set to the computed graph bounds so the scroll view can scroll over
graphs larger than the visible area.
Layout algorithm. Layout runs in four steps whenever the module set changes:
-
Depth via memoized DFS. Each node's dependency depth is
computed recursively. An in-progress sentinel (
-1) guards against cyclic dependencies; a cycle is broken by returning depth 0, placing the cyclic nodes on the same tier rather than causing infinite recursion. -
Tier grouping. Each node's tier is derived from its
Scylla.Core.Editor.ModuleDisplayData.InitPriority via
ScyllaEditorTierUtil.GetTierFromPriority. Nodes sharing the same tier form a horizontal layer. - Within-layer sort. Nodes in each tier layer are sorted ascending by Scylla.Core.Editor.ModuleDisplayData.InitPriority so lower priorities appear to the left.
-
Horizontal centering. Each layer is centered within the
total canvas width (determined by the widest layer). Layers are stacked
top-to-bottom with
VERTICAL_SPACINGbetween them andGRAPH_PADDINGon all sides.
Edge drawing. A two-pass generateVisualContent callback
draws non-highlighted edges first, then highlighted edges on top. Each edge is a
Bezier curve whose tangent offset is half the vertical distance between the two
nodes, with a filled downward-pointing triangle arrowhead at the dependent end.
Edge color varies by ScyllaModuleDependencyType (hard: default,
soft: 50% alpha, event-based: info blue). The selected node's outgoing edges
are drawn brighter and 1 px wider.
Selection. A PointerDownEvent on a node selects it and
stops propagation so the background handler does not immediately deselect.
A PointerDownEvent on the canvas background calls
ClearSelection(). The SelectionChanged event notifies
callers of both select and deselect actions.
Implicit Core dependency. Any module that does not explicitly declare a dependency on Core receives a synthetic hard edge to Core during graph data construction, because all Scylla modules depend on Core by convention.
Constructors
ScyllaDependencyGraphElement()
Creates a new dependency graph element. Add to a flex layout; the element will fill its available space and provide internal scrolling for graphs larger than the visible area.
Declaration
public ScyllaDependencyGraphElement()
Methods
ClearSelection()
Clears the current selection and notifies listeners.
Declaration
public void ClearSelection()
GetSelectedModuleID()
Returns the ID of the currently selected module, or null if none.
Declaration
public string GetSelectedModuleID()
Returns
| Type | Description |
|---|---|
| string |
Events
SelectionChanged
Fires when the user clicks a node. Argument is the new selected module ID, or null on background click.
Declaration
public event Action<string> SelectionChanged
Event Type
| Type | Description |
|---|---|
| Action<string> |