improved mouse behaviour if it leaves the window
This commit is contained in:
@@ -86,14 +86,15 @@ public class InputService
|
||||
}
|
||||
|
||||
var delta = _currentMousePosition.Value - newPosition;
|
||||
_currentMousePosition = newPosition;
|
||||
|
||||
// TODO: Very very bad solution! I need to find a good way to determine if the cursor has left the window and now has re-entered it
|
||||
if (Math.Abs(delta.X) <= 100 || Math.Abs(delta.Y) <= 100)
|
||||
// TODO: Bad solution! I need to find a good way to determine if the cursor has left the window and now has re-entered it
|
||||
if (delta.Length() > 50)
|
||||
{
|
||||
_currentMouseDelta = new Vector2D<float>(-delta.X, delta.Y);
|
||||
return;
|
||||
}
|
||||
|
||||
_currentMousePosition = newPosition;
|
||||
_currentMouseDelta = new Vector2D<float>(-delta.X, delta.Y);
|
||||
}
|
||||
|
||||
private void OnDeviceConnectionChanges(IInputDevice device, bool connected)
|
||||
|
||||
Reference in New Issue
Block a user