diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
| commit | c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch) | |
| tree | ee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/TimeIndicator.cs | |
| download | Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2 Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip | |
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/TimeIndicator.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/TimeIndicator.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/TimeIndicator.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/TimeIndicator.cs new file mode 100644 index 0000000..d896ae5 --- /dev/null +++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/TimeIndicator.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace UnityEditor.Timeline +{ + static class TimeIndicator + { + static readonly Tooltip s_Tooltip = new Tooltip(DirectorStyles.Instance.displayBackground, DirectorStyles.Instance.tinyFont); + + public static void Draw(WindowState state, double time) + { + var bounds = state.timeAreaRect; + bounds.xMin = Mathf.Max(bounds.xMin, state.TimeToTimeAreaPixel(time)); + + using (new GUIViewportScope(state.timeAreaRect)) + { + s_Tooltip.text = TimeReferenceUtility.ToTimeString(time); + + var tooltipBounds = s_Tooltip.bounds; + tooltipBounds.xMin = bounds.xMin - (tooltipBounds.width / 2.0f); + tooltipBounds.y = bounds.y; + s_Tooltip.bounds = tooltipBounds; + + if (time >= 0) + s_Tooltip.Draw(); + } + + if (time >= 0) + { + Graphics.DrawLineAtTime(state, time, Color.black, true); + } + } + + public static void Draw(WindowState state, double start, double end) + { + var bounds = state.timeAreaRect; + bounds.xMin = Mathf.Max(bounds.xMin, state.TimeToTimeAreaPixel(start)); + bounds.xMax = Mathf.Min(bounds.xMax, state.TimeToTimeAreaPixel(end)); + + var color = DirectorStyles.Instance.selectedStyle.focused.textColor; + color.a = 0.12f; + EditorGUI.DrawRect(bounds, color); + + Draw(state, start); + Draw(state, end); + } + } +} |
