History

Fix mouse interaction with overlays in HMDs

Brad Davis committed 11 years ago

Commit dcdf47d1 parent 7ca63a41 file · +12 −1Browse files

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

Unified · Split

interface/src/Application.cpp+12−1
@@ -859,6 +859,18 @@ void Application::initializeUi() { · 858 unmodified lines
859 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));859 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
860 offscreenUi->load("Root.qml");860 offscreenUi->load("Root.qml");
861 offscreenUi->load("RootMenu.qml");861 offscreenUi->load("RootMenu.qml");
862
863 offscreenUi->setMouseTranslator([=](const QPointF& pt) {
864 QPointF result = pt;
865 auto displayPlugin = getActiveDisplayPlugin();
866 if (displayPlugin->isHmd()) {
867 auto resultVec = _compositor.screenToOverlay(toGlm(pt));
868 result = QPointF(resultVec.x, resultVec.y);
869 } else if (displayPlugin->isStereo()) {
870 }
871 return result;
872 });
873
862 VrMenu::load();874 VrMenu::load();
863 VrMenu::executeQueuedLambdas();875 VrMenu::executeQueuedLambdas();
864 offscreenUi->resume();876 offscreenUi->resume();
@@ -4813,7 +4825,6 @@ void Application::updateDisplayMode() { · 3948 unmodified lines
4813 } else {4825 } else {
4814 DependencyManager::get<OffscreenUi>()->setProxyWindow(nullptr);4826 DependencyManager::get<OffscreenUi>()->setProxyWindow(nullptr);
4815 }4827 }
4816 offscreenUi->setMouseTranslator(newDisplayPlugin->getMouseTranslator());
4817 offscreenUi->resize(fromGlm(newDisplayPlugin->getCanvasSize()));4828 offscreenUi->resize(fromGlm(newDisplayPlugin->getCanvasSize()));
4818 _offscreenContext->makeCurrent();4829 _offscreenContext->makeCurrent();
4819 }4830 }