mirror of
https://github.com/overte-org/overte.git
synced 2025-04-18 21:57:10 +02:00
Fix setReticlePosition and getReticlePosition to match.
This commit is contained in:
parent
3f3233da66
commit
af8d0dc280
2 changed files with 3 additions and 17 deletions
|
@ -258,7 +258,7 @@ glm::vec2 CompositorHelper::getReticlePosition() const {
|
|||
QMutexLocker locker(&_reticleLock);
|
||||
return _reticlePositionInHMD;
|
||||
}
|
||||
return toGlm(QCursor::pos());
|
||||
return toGlm(_renderingWidget->mapFromGlobal(QCursor::pos()));
|
||||
}
|
||||
|
||||
bool CompositorHelper::getReticleOverDesktop() const {
|
||||
|
@ -324,20 +324,8 @@ void CompositorHelper::setReticlePosition(const glm::vec2& position, bool sendFa
|
|||
sendFakeMouseEvent();
|
||||
}
|
||||
} else {
|
||||
if (!_mainWindow) {
|
||||
auto windows = qApp->topLevelWindows();
|
||||
QWindow* result = nullptr;
|
||||
for (auto window : windows) {
|
||||
QVariant isMainWindow = window->property("MainWindow");
|
||||
if (!qobject_cast<QQuickWindow*>(window)) {
|
||||
result = window;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_mainWindow = result;;
|
||||
}
|
||||
const int MENU_BAR_HEIGHT = 20;
|
||||
QCursor::setPos(position.x + _mainWindow->x(), position.y + _mainWindow->y() + MENU_BAR_HEIGHT);
|
||||
const QPoint point(position.x, position.y);
|
||||
QCursor::setPos(_renderingWidget->mapToGlobal(point));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <QtCore/QPropertyAnimation>
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
#include <GLMHelpers.h>
|
||||
#include <Transform.h>
|
||||
|
@ -183,7 +182,6 @@ private:
|
|||
bool _fakeMouseEvent { false };
|
||||
|
||||
ReticleInterface* _reticleInterface { nullptr };
|
||||
QWindow* _mainWindow { nullptr };
|
||||
};
|
||||
|
||||
// Scripting interface available to control the Reticle
|
||||
|
|
Loading…
Reference in a new issue