Skip to content

Commit

Permalink
Use UtcNow for double-click check because it's faster
Browse files Browse the repository at this point in the history
  • Loading branch information
mtschoen-unity committed Aug 14, 2020
1 parent b1f7ac7 commit 3e9e734
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Runtime/Scripts/Handles/BaseHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ public void OnBeginDrag(RayEventData eventData)
if (!m_LastClickTimes.TryGetValue(rayOrigin, out lastClickTime))
m_LastClickTimes[rayOrigin] = new DateTime();

var timeSinceLastClick = (float)(DateTime.Now - lastClickTime).TotalSeconds;
m_LastClickTimes[rayOrigin] = DateTime.Now;
var now = DateTime.UtcNow;
var timeSinceLastClick = (float)(now - lastClickTime).TotalSeconds;
m_LastClickTimes[rayOrigin] = now;
if (UIUtils.IsDoubleClick(timeSinceLastClick))
OnDoubleClick(handleEventData);

Expand Down

0 comments on commit 3e9e734

Please sign in to comment.