|
|
|
@ -1,6 +1,9 @@ |
|
|
|
|
using TNode.TNodeCore.Editor.Binding; |
|
|
|
|
using System; |
|
|
|
|
using TNode.TNodeCore.Editor.Binding; |
|
|
|
|
using TNode.TNodeCore.Editor.Models; |
|
|
|
|
using TNodeCore.Editor.NodeGraphView; |
|
|
|
|
using UnityEditor.Experimental.GraphView; |
|
|
|
|
using UnityEngine; |
|
|
|
|
using UnityEngine.UIElements; |
|
|
|
|
|
|
|
|
|
namespace TNode.TNodeCore.Editor.CommentView{ |
|
|
|
@ -14,13 +17,30 @@ namespace TNode.TNodeCore.Editor.CommentView{ |
|
|
|
|
|
|
|
|
|
public CommentView(){ |
|
|
|
|
var txtField = new TextField(); |
|
|
|
|
var btn = new Button(() => { |
|
|
|
|
var graphElement = (Node) this.GetFirstOfType<Node>(); |
|
|
|
|
graphElement.Remove(this); |
|
|
|
|
}); |
|
|
|
|
btn.text = "-"; |
|
|
|
|
this.Add(btn); |
|
|
|
|
this.Add(txtField); |
|
|
|
|
txtField.RegisterValueChangedCallback(evt => { |
|
|
|
|
if (_data != null){ |
|
|
|
|
_data.CommentText = evt.newValue; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
capabilities |= Capabilities.Collapsible | Capabilities.Deletable|Capabilities.Selectable; |
|
|
|
|
|
|
|
|
|
styleSheets.Add(Resources.Load<StyleSheet>("CommentView")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void ClickComment(){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void OnChange(){ |
|
|
|
|
var str = this._data.CommentText; |
|
|
|
|
this.Q<TextField>().value = str; |
|
|
|
|