From c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 19 Apr 2020 17:19:32 -0400 Subject: Inital commit --- .../Editor/Utilities/GUIViewportScope.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Library/PackageCache/com.unity.timeline@1.2.13/Editor/Utilities/GUIViewportScope.cs (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/Utilities/GUIViewportScope.cs') diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Utilities/GUIViewportScope.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Utilities/GUIViewportScope.cs new file mode 100644 index 0000000..7999ffd --- /dev/null +++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Utilities/GUIViewportScope.cs @@ -0,0 +1,34 @@ +using System; +using UnityEngine; + +namespace UnityEditor +{ + // Special Clip Scope that only effects painting, and keeps the coordinate system identical + struct GUIViewportScope : IDisposable + { + bool m_open; + public GUIViewportScope(Rect position) + { + m_open = false; + if (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout) + { + GUI.BeginClip(position, -position.min, Vector2.zero, false); + m_open = true; + } + } + + public void Dispose() + { + CloseScope(); + } + + void CloseScope() + { + if (m_open) + { + GUI.EndClip(); + m_open = false; + } + } + } +} -- cgit v1.2.3