mirror of
https://github.com/JulianGro/overte.git
synced 2025-06-07 07:47:05 +02:00
Fix gracefulControls not working on multi-monitor setups
This commit is contained in:
parent
b95a2180e8
commit
2680fb1594
1 changed files with 9 additions and 7 deletions
|
@ -65,8 +65,9 @@ var velocity = { x: 0, y: 0, z: 0 };
|
||||||
var velocityVertical = 0;
|
var velocityVertical = 0;
|
||||||
var enabled = false;
|
var enabled = false;
|
||||||
|
|
||||||
var lastX = Reticle.getPosition().x;
|
var pos = Reticle.getPosition();
|
||||||
var lastY = Reticle.getPosition().y;
|
var lastX = pos.x;
|
||||||
|
var lastY = pos.y;
|
||||||
var yawFromMouse = 0;
|
var yawFromMouse = 0;
|
||||||
var pitchFromMouse = 0;
|
var pitchFromMouse = 0;
|
||||||
|
|
||||||
|
@ -76,8 +77,9 @@ var pitchSpeed = 0;
|
||||||
|
|
||||||
function update(dt) {
|
function update(dt) {
|
||||||
if (enabled && Window.hasFocus()) {
|
if (enabled && Window.hasFocus()) {
|
||||||
var x = Reticle.getPosition().x;
|
var pos = Reticle.getPosition();
|
||||||
var y = Reticle.getPosition().y;
|
var x = pos.x;
|
||||||
|
var y = pos.y;
|
||||||
|
|
||||||
var dx = x - lastX;
|
var dx = x - lastX;
|
||||||
var dy = y - lastY;
|
var dy = y - lastY;
|
||||||
|
@ -164,9 +166,9 @@ function vecToString(vec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCursorPosition() {
|
function resetCursorPosition() {
|
||||||
var newX = Math.floor(Window.x + Window.innerWidth / 2);
|
var newX = Math.floor(Window.innerWidth / 2);
|
||||||
var newY = Math.floor(Window.y + Window.innerHeight / 2);
|
var newY = Math.floor(Window.innerHeight / 2);
|
||||||
Reticle.setPosition({ x: newX, y: newY});
|
Reticle.setPosition({ x: newX, y: newY });
|
||||||
lastX = newX;
|
lastX = newX;
|
||||||
lastY = newY;
|
lastY = newY;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue