Skip to content

Commit 24ba702

Browse files
committed
Fixed tooltip sometimes sticking around
1 parent 757a031 commit 24ba702

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

Assets/Nessie/ASE/Editor/ColorDebug.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ internal class ColorDebug
1818

1919
private static bool m_didBindKeyPress;
2020
private static bool m_isHoldingHotkey;
21+
private static bool m_tooltipActive;
2122

2223
#endregion Private Fields
2324

@@ -66,19 +67,28 @@ private static void PostAssemblyReload()
6667

6768
private static void OnGlobalKeyPress()
6869
{
69-
m_isHoldingHotkey = Event.current != null && Event.current.control && Event.current.type == EventType.KeyDown;
70+
m_isHoldingHotkey = Event.current != null && Event.current.control;
7071
}
7172

7273
[HarmonyPatch(typeof(AmplifyShaderEditorWindow), nameof(AmplifyShaderEditorWindow.UpdateNodePreviewListAndTime))]
7374
private static class PatchWindowUpdate
7475
{
7576
private static void Prefix(AmplifyShaderEditorWindow __instance, ref bool ___m_repaintIsDirty)
7677
{
78+
if (!UseHotkey || !m_didBindKeyPress) return;
79+
7780
if (UIUtils.CurrentWindow != __instance) return;
7881

79-
if (UseHotkey && m_didBindKeyPress && !m_isHoldingHotkey) return;
80-
81-
___m_repaintIsDirty = true;
82+
if (m_isHoldingHotkey)
83+
{
84+
m_tooltipActive = true;
85+
___m_repaintIsDirty = true;
86+
}
87+
else if (m_tooltipActive)
88+
{
89+
m_tooltipActive = false;
90+
___m_repaintIsDirty = true;
91+
}
8292
}
8393
}
8494

@@ -87,7 +97,7 @@ private static class PatchWindowOnGUI
8797
{
8898
private static void Postfix(ParentGraph ___m_customGraph, ParentGraph ___m_mainGraphInstance, Vector2 ___m_currentMousePos2D)
8999
{
90-
if (UseHotkey && Event.current != null && !Event.current.control) return;
100+
if (!m_tooltipActive) return;
91101

92102
ParentGraph currentGraph = ___m_customGraph ? ___m_customGraph : ___m_mainGraphInstance;
93103
ParentNode node = ASEExtensions.GetActiveNode(___m_currentMousePos2D, currentGraph.AllNodes);

0 commit comments

Comments
 (0)