mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 14:29:13 +02:00
Fixed llack of precision in mouse look mode
This commit is contained in:
parent
51a26522b9
commit
c49c947984
3 changed files with 13 additions and 3 deletions
|
@ -6326,6 +6326,9 @@ void Application::update(float deltaTime) {
|
||||||
if (QCursor::pos() != point) {
|
if (QCursor::pos() != point) {
|
||||||
_mouseCaptureTarget = point;
|
_mouseCaptureTarget = point;
|
||||||
_ignoreMouseMove = true;
|
_ignoreMouseMove = true;
|
||||||
|
if (_captureMouse) {
|
||||||
|
_keyboardMouseDevice->updateMousePositionForCapture(QCursor::pos(), _mouseCaptureTarget);
|
||||||
|
}
|
||||||
QCursor::setPos(point);
|
QCursor::setPos(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,14 +113,18 @@ void KeyboardMouseDevice::eraseMouseClicked() {
|
||||||
_inputDevice->_buttonPressedMap.erase(_inputDevice->makeInput(Qt::RightButton, true).getChannel());
|
_inputDevice->_buttonPressedMap.erase(_inputDevice->makeInput(Qt::RightButton, true).getChannel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyboardMouseDevice::updateMousePositionForCapture(QPoint globalPos, QPointF captureTarget) {
|
||||||
|
if (!isNaN(captureTarget.x())) {
|
||||||
|
QPointF change = globalPos - captureTarget;
|
||||||
|
_accumulatedMove += QPoint(change.x(), change.y());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void KeyboardMouseDevice::mouseMoveEvent(QMouseEvent* event, bool capture, QPointF captureTarget) {
|
void KeyboardMouseDevice::mouseMoveEvent(QMouseEvent* event, bool capture, QPointF captureTarget) {
|
||||||
QPoint currentPos = event->pos();
|
QPoint currentPos = event->pos();
|
||||||
|
|
||||||
if (!capture) {
|
if (!capture) {
|
||||||
_accumulatedMove += currentPos - _lastCursor;
|
_accumulatedMove += currentPos - _lastCursor;
|
||||||
} else if (!isNaN(captureTarget.x())) {
|
|
||||||
QPointF change = event->globalPos() - captureTarget;
|
|
||||||
_accumulatedMove += QPoint(change.x(), change.y());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - this has the characteristic that it will show large jumps when you move the cursor
|
// FIXME - this has the characteristic that it will show large jumps when you move the cursor
|
||||||
|
|
|
@ -93,6 +93,9 @@ public:
|
||||||
void wheelEvent(QWheelEvent* event);
|
void wheelEvent(QWheelEvent* event);
|
||||||
bool isWheelByTouchPad(QWheelEvent* event);
|
bool isWheelByTouchPad(QWheelEvent* event);
|
||||||
|
|
||||||
|
// This gets called from Application::update just before resetting cursor position when mouse capture is enabled
|
||||||
|
void updateMousePositionForCapture(QPoint globalPos, QPointF captureTarget);
|
||||||
|
|
||||||
static void enableTouch(bool enableTouch) { _enableTouch = enableTouch; }
|
static void enableTouch(bool enableTouch) { _enableTouch = enableTouch; }
|
||||||
|
|
||||||
static const char* NAME;
|
static const char* NAME;
|
||||||
|
|
Loading…
Reference in a new issue