History

Merge pull request #7879 from howard-stearns/fix-reticle-offset

fix reticle position offset

Brad Hefta-Gaub committed 10 years ago

Commit 0d5fdbd2 parents c443138 40f72121 file · +6 −17Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+6−17
@@ -864,10 +864,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 863 unmodified lines
864864
865865 if (action == controller::toInt(controller::Action::RETICLE_CLICK)) {
866866 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.
871868 if (state) {
872869 QMouseEvent mousePress(QEvent::MouseButtonPress, localPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
873870 sendEvent(_glWidget, &mousePress);
@@ -888,15 +885,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 14 unmodified lines
888885 } else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) {
889886 if (!offscreenUi->navigationFocused()) {
890887 auto reticlePosition = getApplicationCompositor().getReticlePosition();
891− offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
888+ offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
892889 }
893890 } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) {
894891 auto reticlePosition = getApplicationCompositor().getReticlePosition();
895− offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
892+ offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
896893 } else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) {
897894 if (!offscreenUi->navigationFocused()) {
898895 auto reticlePosition = getApplicationCompositor().getReticlePosition();
899− offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
896+ offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
900897 }
901898 } else if (action == controller::toInt(controller::Action::RETICLE_X)) {
902899 auto oldPos = getApplicationCompositor().getReticlePosition();
@@ -2268,7 +2265,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 1365 unmodified lines
22682265 if (event->key() == Qt::Key_Alt && _altPressed && hasFocus()) {
22692266 auto offscreenUi = DependencyManager::get<OffscreenUi>();
22702267 auto reticlePosition = getApplicationCompositor().getReticlePosition();
2271− offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y)));
2268+ offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y));
22722269 }
22732270
22742271 _keysPressed.remove(event->key());
@@ -2737,15 +2734,7 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) { · 462 unmodified lines
27372734 }
27382735
27392736 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();
27492738 }
27502739
27512740 FaceTracker* Application::getActiveFaceTracker() {