mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
# fixed Node header tooltip bug
This commit is contained in:
parent
cdb08154e2
commit
76b25c49b1
@ -556,20 +556,15 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void DrawTooltip() {
|
private void DrawTooltip() {
|
||||||
if (!NodeEditorPreferences.GetSettings().portTooltips && graphEditor != null)
|
if (!NodeEditorPreferences.GetSettings().portTooltips || graphEditor is null)
|
||||||
return;
|
return;
|
||||||
|
string tooltip = null;
|
||||||
if (hoveredPort != null) {
|
if (hoveredPort != null) {
|
||||||
string tooltip = graphEditor.GetPortTooltip(hoveredPort);
|
tooltip = graphEditor.GetPortTooltip(hoveredPort);
|
||||||
if (string.IsNullOrEmpty(tooltip)) return;
|
|
||||||
GUIContent content = new GUIContent(tooltip);
|
|
||||||
Vector2 size = NodeEditorResources.styles.tooltip.CalcSize(content);
|
|
||||||
size.x += 8;
|
|
||||||
Rect rect = new Rect(Event.current.mousePosition - (size), size);
|
|
||||||
EditorGUI.LabelField(rect, content, NodeEditorResources.styles.tooltip);
|
|
||||||
Repaint();
|
|
||||||
}
|
}
|
||||||
else if (hoveredNode != null && IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
else if (hoveredNode != null && IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
||||||
string tooltip = graphEditor.GetNodeTooltip(hoveredNode);
|
tooltip = graphEditor.GetNodeTooltip(hoveredNode);
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(tooltip)) return;
|
if (string.IsNullOrEmpty(tooltip)) return;
|
||||||
GUIContent content = new GUIContent(tooltip);
|
GUIContent content = new GUIContent(tooltip);
|
||||||
Vector2 size = NodeEditorResources.styles.tooltip.CalcSize(content);
|
Vector2 size = NodeEditorResources.styles.tooltip.CalcSize(content);
|
||||||
@ -579,5 +574,4 @@ namespace XNodeEditor {
|
|||||||
Repaint();
|
Repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user