Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all
Unified · Split
| @@ -806,39 +806,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 805 unmodified lines | ||
| 806 | 806 | } else if (action == controller::toInt(controller::Action::CYCLE_CAMERA)) { |
| 807 | 807 | cycleCamera(); |
| 808 | 808 | } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) { |
| 809 | − offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QCursor::pos())); | |
| 809 | + auto reticlePosition = _controllerScriptingInterface->getReticlePosition(); | |
| 810 | + offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 810 | 811 | } else if (action == controller::toInt(controller::Action::RETICLE_X)) { |
| 811 | − auto oldPos = QCursor::pos(); | |
| 812 | − auto newPos = oldPos; | |
| 813 | − newPos.setX(oldPos.x() + state); | |
| 814 | − QCursor::setPos(newPos); | |
| 815 | − | |
| 816 | − | |
| 817 | − // NOTE: This is some debugging code we will leave in while debugging various reticle movement strategies, | |
| 818 | − // remove it after we're done | |
| 819 | − const float REASONABLE_CHANGE = 50.0f; | |
| 820 | − glm::vec2 oldPosG = { oldPos.x(), oldPos.y() }; | |
| 821 | − glm::vec2 newPosG = { newPos.x(), newPos.y() }; | |
| 822 | − auto distance = glm::distance(oldPosG, newPosG); | |
| 823 | − if (distance > REASONABLE_CHANGE) { | |
| 824 | − qDebug() << "Action::RETICLE_X... UNREASONABLE CHANGE! distance:" << distance << " oldPos:" << oldPosG << " newPos:" << newPosG; | |
| 825 | − } | |
| 826 | − | |
| 812 | + auto oldPos = _controllerScriptingInterface->getReticlePosition(); | |
| 813 | + _controllerScriptingInterface->setReticlePosition({ oldPos.x + state, oldPos.y }); | |
| 827 | 814 | } else if (action == controller::toInt(controller::Action::RETICLE_Y)) { |
| 828 | − auto oldPos = QCursor::pos(); | |
| 829 | − auto newPos = oldPos; | |
| 830 | − newPos.setY(oldPos.y() + state); | |
| 831 | − QCursor::setPos(newPos); | |
| 832 | − | |
| 833 | − // NOTE: This is some debugging code we will leave in while debugging various reticle movement strategies, | |
| 834 | − // remove it after we're done | |
| 835 | − const float REASONABLE_CHANGE = 50.0f; | |
| 836 | − glm::vec2 oldPosG = { oldPos.x(), oldPos.y() }; | |
| 837 | − glm::vec2 newPosG = { newPos.x(), newPos.y() }; | |
| 838 | − auto distance = glm::distance(oldPosG, newPosG); | |
| 839 | − if (distance > REASONABLE_CHANGE) { | |
| 840 | − qDebug() << "Action::RETICLE_Y... UNREASONABLE CHANGE! distance:" << distance << " oldPos:" << oldPosG << " newPos:" << newPosG; | |
| 841 | − } | |
| 815 | + auto oldPos = _controllerScriptingInterface->getReticlePosition(); | |
| 816 | + _controllerScriptingInterface->setReticlePosition({ oldPos.x, oldPos.y + state }); | |
| 842 | 817 | } |
| 843 | 818 | } |
| 844 | 819 | }); |
| @@ -2110,7 +2085,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 1265 unmodified lines | ||
| 2110 | 2085 | void Application::keyReleaseEvent(QKeyEvent* event) { |
| 2111 | 2086 | if (event->key() == Qt::Key_Alt && _altPressed && hasFocus()) { |
| 2112 | 2087 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 2113 | − offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QCursor::pos())); | |
| 2088 | + auto reticlePosition = _controllerScriptingInterface->getReticlePosition(); | |
| 2089 | + offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 2114 | 2090 | } |
| 2115 | 2091 | |
| 2116 | 2092 | _keysPressed.remove(event->key()); |
| @@ -4727,8 +4703,10 @@ bool Application::isThrottleRendering() const { · 2610 unmodified lines | ||
| 4727 | 4703 | return getActiveDisplayPlugin()->isThrottled(); |
| 4728 | 4704 | } |
| 4729 | 4705 | |
| 4706 | +// FIXME -- consolidate users of getTrueMouse() controllerScriptingInterface->getReticlePosition() | |
| 4730 | 4707 | ivec2 Application::getTrueMouse() const { |
| 4731 | − return toGlm(_glWidget->mapFromGlobal(QCursor::pos())); | |
| 4708 | + auto reticlePosition = _controllerScriptingInterface->getReticlePosition(); | |
| 4709 | + return toGlm(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); | |
| 4732 | 4710 | } |
| 4733 | 4711 | |
| 4734 | 4712 | bool Application::hasFocus() const { |