fix reticle position offset
Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -864,10 +864,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 863 unmodified lines | ||
| 864 | 864 | |
| 865 | 865 | if (action == controller::toInt(controller::Action::RETICLE_CLICK)) { |
| 866 | 866 | auto reticlePos = getApplicationCompositor().getReticlePosition(); |
| 867 | − QPoint globalPos(reticlePos.x, reticlePos.y); | |
| 868 | − | |
| 869 | − // FIXME - it would be nice if this was self contained in the _compositor or Reticle class | |
| 870 | − auto localPos = isHMDMode() ? globalPos : _glWidget->mapFromGlobal(globalPos); | |
| 867 | + QPoint localPos(reticlePos.x, reticlePos.y); // both hmd and desktop already handle this in our coordinates. | |
| 871 | 868 | if (state) { |
| 872 | 869 | QMouseEvent mousePress(QEvent::MouseButtonPress, localPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); |
| 873 | 870 | sendEvent(_glWidget, &mousePress); |
| @@ -888,15 +885,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 14 unmodified lines | ||
| 888 | 885 | } else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) { |
| 889 | 886 | if (!offscreenUi->navigationFocused()) { |
| 890 | 887 | auto reticlePosition = getApplicationCompositor().getReticlePosition(); |
| 891 | − offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 888 | + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); | |
| 892 | 889 | } |
| 893 | 890 | } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) { |
| 894 | 891 | auto reticlePosition = getApplicationCompositor().getReticlePosition(); |
| 895 | − offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 892 | + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); | |
| 896 | 893 | } else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) { |
| 897 | 894 | if (!offscreenUi->navigationFocused()) { |
| 898 | 895 | auto reticlePosition = getApplicationCompositor().getReticlePosition(); |
| 899 | − offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 896 | + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); | |
| 900 | 897 | } |
| 901 | 898 | } else if (action == controller::toInt(controller::Action::RETICLE_X)) { |
| 902 | 899 | auto oldPos = getApplicationCompositor().getReticlePosition(); |
| @@ -2268,7 +2265,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 1365 unmodified lines | ||
| 2268 | 2265 | if (event->key() == Qt::Key_Alt && _altPressed && hasFocus()) { |
| 2269 | 2266 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 2270 | 2267 | auto reticlePosition = getApplicationCompositor().getReticlePosition(); |
| 2271 | − offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 2268 | + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); | |
| 2272 | 2269 | } |
| 2273 | 2270 | |
| 2274 | 2271 | _keysPressed.remove(event->key()); |
| @@ -2737,15 +2734,7 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) { · 462 unmodified lines | ||
| 2737 | 2734 | } |
| 2738 | 2735 | |
| 2739 | 2736 | ivec2 Application::getMouse() const { |
| 2740 | − auto reticlePosition = getApplicationCompositor().getReticlePosition(); | |
| 2741 | − | |
| 2742 | − // in the HMD, the reticlePosition is the mouse position | |
| 2743 | − if (isHMDMode()) { | |
| 2744 | − return reticlePosition; | |
| 2745 | − } | |
| 2746 | − | |
| 2747 | − // in desktop mode, we need to map from global to widget space | |
| 2748 | − return toGlm(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 2737 | + return getApplicationCompositor().getReticlePosition(); | |
| 2749 | 2738 | } |
| 2750 | 2739 | |
| 2751 | 2740 | FaceTracker* Application::getActiveFaceTracker() { |