mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 14:38:34 +01:00
preserve position and scroll wheel value when the mouse is out of bounds
This commit is contained in:
parent
73eab1d41e
commit
eb3194a0c1
1 changed files with 6 additions and 5 deletions
|
@ -181,11 +181,12 @@ namespace MLEM.Input {
|
||||||
|
|
||||||
if (this.HandleMouse) {
|
if (this.HandleMouse) {
|
||||||
this.LastMouseState = this.MouseState;
|
this.LastMouseState = this.MouseState;
|
||||||
this.MouseState = default;
|
|
||||||
if (active) {
|
|
||||||
var state = Mouse.GetState();
|
var state = Mouse.GetState();
|
||||||
if (this.Game.GraphicsDevice.Viewport.Bounds.Contains(state.Position))
|
if (active && this.Game.GraphicsDevice.Viewport.Bounds.Contains(state.Position)) {
|
||||||
this.MouseState = state;
|
this.MouseState = state;
|
||||||
|
} else {
|
||||||
|
// mouse position and scroll wheel value should be preserved when the mouse is out of bounds
|
||||||
|
this.MouseState = new MouseState(state.X, state.Y, state.ScrollWheelValue, 0, 0, 0, 0, 0, state.HorizontalScrollWheelValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue