The "constrained" property for a mouse mode now actually constrains
the mouse rather than wrapping it. Wrapping around to the other side of the screen has very bad consequences when using the mouse for flying or viewing -- it can result in sudden jumps in the controls or the viewpoint when the mouse jumps to another side of the screen. Right now, the mouse is constrained to stay between 25% and 75% of the screen on both the X and Y axis -- whenever it hits an edge, it jumps back to the centre of the screen again (which causes no control or view jump).
This commit is contained in:
parent
2aedb080d7
commit
85707f1e49
1 changed files with 4 additions and 10 deletions
|
@ -387,19 +387,13 @@ FGInput::doMouseMotion (int x, int y)
|
|||
// Constrain the mouse if requested
|
||||
if (mode.constrained) {
|
||||
bool need_warp = false;
|
||||
if (x <= 0) {
|
||||
x = xsize - 2;
|
||||
need_warp = true;
|
||||
} else if (x >= (xsize-1)) {
|
||||
x = 1;
|
||||
if (x <= (xsize * .25) || x >= (xsize * .75)) {
|
||||
x = int(xsize * .5);
|
||||
need_warp = true;
|
||||
}
|
||||
|
||||
if (y <= 0) {
|
||||
y = ysize - 2;
|
||||
need_warp = true;
|
||||
} else if (y >= (ysize-1)) {
|
||||
y = 1;
|
||||
if (y <= (ysize * .25) || y >= (ysize * .75)) {
|
||||
y = int(ysize * .5);
|
||||
need_warp = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue