Skip to content

Commit

Permalink
fix: Improve reliability of new sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Jan 15, 2025
1 parent 453e0ab commit ed71c81
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Uno.UWP/UI/Input/Preview.Injection/InjectedInputState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class InjectedInputState
public InjectedInputState(PointerDeviceType type)
{
Type = type;
StartNewSequence();
StartNewSequence(true);
}

public PointerDeviceType Type { get; }
Expand All @@ -31,9 +31,17 @@ public InjectedInputState(PointerDeviceType type)

public PointerPointProperties Properties { get; set; } = new();

public void StartNewSequence()
public void StartNewSequence(bool initial = false)
{
Timestamp = (ulong)Stopwatch.GetElapsedTime(_initialTimestamp).TotalMicroseconds;
if (initial)
{
Timestamp = (ulong)Stopwatch.GetElapsedTime(_initialTimestamp).TotalMicroseconds;
}
else
{
Timestamp = Timestamp + 1000; // Continue from the previous timestamp, but move forward in time by 1ms
}

FrameId = (uint)(Timestamp / 1000);
}

Expand Down

0 comments on commit ed71c81

Please sign in to comment.