forked from alelievr/NodeGraphProcessor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStickyNoteView.cs
More file actions
57 lines (48 loc) · 1.39 KB
/
Copy pathStickyNoteView.cs
File metadata and controls
57 lines (48 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#if UNITY_2020_1_OR_NEWER
using UnityEngine;
using UnityEditor.Experimental.GraphView;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace GraphProcessor
{
public class StickyNoteView : UnityEditor.Experimental.GraphView.StickyNote
{
public BaseGraphView owner;
public StickyNote note;
Label titleLabel;
ColorField colorField;
public StickyNoteView()
{
fontSize = StickyNoteFontSize.Small;
theme = StickyNoteTheme.Classic;
}
public void Initialize(BaseGraphView graphView, StickyNote note)
{
this.note = note;
owner = graphView;
this.Q<TextField>("title-field").RegisterCallback<ChangeEvent<string>>(e => {
note.title = e.newValue;
});
this.Q<TextField>("contents-field").RegisterCallback<ChangeEvent<string>>(e => {
note.content = e.newValue;
});
title = note.title;
contents = note.content;
SetPosition(note.position);
}
public override void SetPosition(Rect newPos)
{
base.SetPosition(newPos);
if (note != null)
note.position = newPos;
}
public override void OnResized()
{
note.position = layout;
}
}
}
#endif