mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 16:18:03 +02:00
Merge pull request #7879 from howard-stearns/fix-reticle-offset
fix reticle position offset
This commit is contained in:
commit
0d5fdbdb6e
1 changed files with 6 additions and 17 deletions
|
@ -864,10 +864,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
|
|
||||||
if (action == controller::toInt(controller::Action::RETICLE_CLICK)) {
|
if (action == controller::toInt(controller::Action::RETICLE_CLICK)) {
|
||||||
auto reticlePos = getApplicationCompositor().getReticlePosition();
|
auto reticlePos = getApplicationCompositor().getReticlePosition();
|
||||||
QPoint globalPos(reticlePos.x, reticlePos.y);
|
QPoint localPos(reticlePos.x, reticlePos.y); // both hmd and desktop already handle this in our coordinates.
|
||||||
|
|
||||||
// FIXME - it would be nice if this was self contained in the _compositor or Reticle class
|
|
||||||
auto localPos = isHMDMode() ? globalPos : _glWidget->mapFromGlobal(globalPos);
|
|
||||||
if (state) {
|
if (state) {
|
||||||
QMouseEvent mousePress(QEvent::MouseButtonPress, localPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
QMouseEvent mousePress(QEvent::MouseButtonPress, localPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||||
sendEvent(_glWidget, &mousePress);
|
sendEvent(_glWidget, &mousePress);
|
||||||
|
@ -888,15 +885,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
} else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) {
|
} else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) {
|
||||||
if (!offscreenUi->navigationFocused()) {
|
if (!offscreenUi->navigationFocused()) {
|
||||||
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
||||||
offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
|
offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
|
||||||
}
|
}
|
||||||
} else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) {
|
} else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) {
|
||||||
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
||||||
offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
|
offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
|
||||||
} else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) {
|
} else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) {
|
||||||
if (!offscreenUi->navigationFocused()) {
|
if (!offscreenUi->navigationFocused()) {
|
||||||
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
||||||
offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
|
offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
|
||||||
}
|
}
|
||||||
} else if (action == controller::toInt(controller::Action::RETICLE_X)) {
|
} else if (action == controller::toInt(controller::Action::RETICLE_X)) {
|
||||||
auto oldPos = getApplicationCompositor().getReticlePosition();
|
auto oldPos = getApplicationCompositor().getReticlePosition();
|
||||||
|
@ -2268,7 +2265,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
|
||||||
if (event->key() == Qt::Key_Alt && _altPressed && hasFocus()) {
|
if (event->key() == Qt::Key_Alt && _altPressed && hasFocus()) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
||||||
offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
|
offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
_keysPressed.remove(event->key());
|
_keysPressed.remove(event->key());
|
||||||
|
@ -2737,15 +2734,7 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ivec2 Application::getMouse() const {
|
ivec2 Application::getMouse() const {
|
||||||
auto reticlePosition = getApplicationCompositor().getReticlePosition();
|
return getApplicationCompositor().getReticlePosition();
|
||||||
|
|
||||||
// in the HMD, the reticlePosition is the mouse position
|
|
||||||
if (isHMDMode()) {
|
|
||||||
return reticlePosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
// in desktop mode, we need to map from global to widget space
|
|
||||||
return toGlm(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FaceTracker* Application::getActiveFaceTracker() {
|
FaceTracker* Application::getActiveFaceTracker() {
|
||||||
|
|
Loading…
Reference in a new issue