edge visibility
This commit is contained in:
parent
52f2856307
commit
ad5ad99975
@ -4,17 +4,34 @@ using UnityEngine.UIElements;
|
|||||||
|
|
||||||
namespace AsmdefHelper.DependencyGraph.Editor {
|
namespace AsmdefHelper.DependencyGraph.Editor {
|
||||||
public class AsmdefNode : UiElementsNodeView, IAsmdefNodeView {
|
public class AsmdefNode : UiElementsNodeView, IAsmdefNodeView {
|
||||||
public IPort LeftPort { get; }
|
readonly GraphViewPort leftPort;
|
||||||
public IPort RightPort { get; }
|
readonly GraphViewPort rightPort;
|
||||||
|
public IPort LeftPort => leftPort;
|
||||||
|
public IPort RightPort => rightPort;
|
||||||
|
|
||||||
public AsmdefNode(string nodeName, VisualElement parentContentContainer) {
|
public AsmdefNode(string nodeName, VisualElement parentContentContainer) {
|
||||||
Label = nodeName;
|
Label = nodeName;
|
||||||
|
|
||||||
LeftPort = new GraphViewPort(parentContentContainer, Direction.Input) { Label = "Ref By" };
|
leftPort = new GraphViewPort(parentContentContainer, Direction.Input) { Label = "Ref By" };
|
||||||
inputContainer.Add(LeftPort as Port); // as right side
|
inputContainer.Add(LeftPort as Port); // as right side
|
||||||
|
|
||||||
RightPort = new GraphViewPort(parentContentContainer, Direction.Output) { Label = "Ref To" };
|
rightPort = new GraphViewPort(parentContentContainer, Direction.Output) { Label = "Ref To" };
|
||||||
outputContainer.Add(RightPort as Port); // as left side
|
outputContainer.Add(RightPort as Port); // as left side
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Visibility {
|
||||||
|
get => base.Visibility;
|
||||||
|
set {
|
||||||
|
base.Visibility = value;
|
||||||
|
// right(output)
|
||||||
|
foreach (var edge in rightPort.connections) {
|
||||||
|
edge.visible = edge.input.node.visible & visible;
|
||||||
|
}
|
||||||
|
// left(input)
|
||||||
|
foreach (var edge in leftPort.connections) {
|
||||||
|
edge.visible = edge.output.node.visible & visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace AsmdefHelper.DependencyGraph.Editor.NodeView {
|
|||||||
|
|
||||||
public float Width => contentRect.width;
|
public float Width => contentRect.width;
|
||||||
|
|
||||||
public bool Visibility {
|
public virtual bool Visibility {
|
||||||
get => visible;
|
get => visible;
|
||||||
set => visible = value;
|
set => visible = value;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user