From dcdf47dd666acef7bcdc424f85a0ee61c5e82c20 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sun, 28 Jun 2015 22:51:26 -0700 Subject: [PATCH] Fix mouse interaction with overlays in HMDs --- interface/src/Application.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9085fbd434..eefc881719 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -859,6 +859,18 @@ void Application::initializeUi() { offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/")); offscreenUi->load("Root.qml"); offscreenUi->load("RootMenu.qml"); + + offscreenUi->setMouseTranslator([=](const QPointF& pt) { + QPointF result = pt; + auto displayPlugin = getActiveDisplayPlugin(); + if (displayPlugin->isHmd()) { + auto resultVec = _compositor.screenToOverlay(toGlm(pt)); + result = QPointF(resultVec.x, resultVec.y); + } else if (displayPlugin->isStereo()) { + } + return result; + }); + VrMenu::load(); VrMenu::executeQueuedLambdas(); offscreenUi->resume(); @@ -4813,7 +4825,6 @@ void Application::updateDisplayMode() { } else { DependencyManager::get()->setProxyWindow(nullptr); } - offscreenUi->setMouseTranslator(newDisplayPlugin->getMouseTranslator()); offscreenUi->resize(fromGlm(newDisplayPlugin->getCanvasSize())); _offscreenContext->makeCurrent(); }