private void Update(List<TouchLocation> touches, ref TouchLocation? touch)
{
foreach (var touchLocation in touches)
{
if (touchLocation.Id == Id)
{
touch = touchLocation;
break;
}
TouchLocation earliestTouchLocation;
if (!touchLocation.TryGetPreviousLocation(out earliestTouchLocation))
earliestTouchLocation = touchLocation;
if (Id == -1)
{
if (TouchArea.Contains(earliestTouchLocation.Position.ToPoint()))
{
touch = earliestTouchLocation;
break;
}
}
}
if (touch.HasValue)
{
Id = touch.Value.Id;
}
else
{
Id = -1;
}
}
}