improved mouse behaviour if it leaves the window

This commit is contained in:
2026-01-03 19:15:02 +01:00
parent 2557f4d6a0
commit e91bf12a3d

View File

@@ -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)