Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Input/Touch/GestureDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ internal static void OnPressed(int fingerId, Vector2 touchPosition)
if (IsGestureEnabled(GestureType.DoubleTap))
{
// Must tap again within 300ms of original tap's release
TimeSpan timeSinceRelease = DateTime.Now - eventTimestamp;
TimeSpan timeSinceRelease = DateTime.UtcNow - eventTimestamp;
if (timeSinceRelease <= TimeSpan.FromMilliseconds(300))
{
// If the new tap is close to the original tap
Expand Down Expand Up @@ -171,7 +171,7 @@ internal static void OnPressed(int fingerId, Vector2 touchPosition)

state = GestureState.HOLDING;
pressPosition = touchPosition;
eventTimestamp = DateTime.Now;
eventTimestamp = DateTime.UtcNow;
}

internal static void OnReleased(int fingerId, Vector2 touchPosition)
Expand Down Expand Up @@ -208,7 +208,7 @@ internal static void OnReleased(int fingerId, Vector2 touchPosition)
if (tapEnabled || dtapEnabled)
{
// How long did the user hold the touch?
TimeSpan timeHeld = DateTime.Now - eventTimestamp;
TimeSpan timeHeld = DateTime.UtcNow - eventTimestamp;
if (timeHeld < TimeSpan.FromSeconds(1))
{
// Don't register a Tap immediately after a Double Tap
Expand Down Expand Up @@ -323,7 +323,7 @@ internal static void OnReleased(int fingerId, Vector2 touchPosition)
state = GestureState.NONE;
}

eventTimestamp = DateTime.Now;
eventTimestamp = DateTime.UtcNow;
}

internal static void OnMoved(int fingerId, Vector2 touchPosition, Vector2 delta)
Expand Down Expand Up @@ -501,14 +501,14 @@ internal static void OnUpdate()
* -caleb
*/

float dt = (float)(DateTime.Now - updateTimestamp).TotalSeconds;
float dt = (float)(DateTime.UtcNow - updateTimestamp).TotalSeconds;
Vector2 delta = activeFingerPosition - lastUpdatePosition;
Vector2 instVelocity = delta / (0.001f + dt);
velocity += (instVelocity - velocity) * 0.45f;
}

lastUpdatePosition = activeFingerPosition;
updateTimestamp = DateTime.Now;
updateTimestamp = DateTime.UtcNow;
}

#endregion
Expand All @@ -517,7 +517,7 @@ internal static void OnUpdate()

if (IsGestureEnabled(GestureType.Hold) && state == GestureState.HOLDING)
{
TimeSpan timeSincePress = DateTime.Now - eventTimestamp;
TimeSpan timeSincePress = DateTime.UtcNow - eventTimestamp;
if (timeSincePress >= TimeSpan.FromSeconds(1))
{
// Hold!
Expand Down