From bf0fb7258a49f59b29a5df740d49026e4f9e32c5 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 25 Feb 2016 22:01:10 -0800 Subject: [PATCH] CR feedback --- interface/src/Application.cpp | 7 ++++--- interface/src/ui/OverlayConductor.cpp | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b072867400..64a9ef2029 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -818,7 +818,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : auto oldPos = _compositor.getReticlePosition(); _compositor.setReticlePosition({ oldPos.x, oldPos.y + state }); } else if (action == controller::toInt(controller::Action::TOGGLE_OVERLAY)) { - _overlayConductor.setEnabled(!_overlayConductor.getEnabled()); + toggleOverlays(); } } }); @@ -3003,8 +3003,9 @@ void Application::updateThreads(float deltaTime) { } void Application::toggleOverlays() { - auto overlaysVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays); - _overlayConductor.setEnabled(overlaysVisible); + auto newOverlaysVisible = !_overlayConductor.getEnabled(); + Menu::getInstance()->setIsOptionChecked(MenuOption::Overlays, newOverlaysVisible); + _overlayConductor.setEnabled(newOverlaysVisible); } void Application::setOverlaysVisible(bool visible) { diff --git a/interface/src/ui/OverlayConductor.cpp b/interface/src/ui/OverlayConductor.cpp index 324ec8583b..113dad1ab5 100644 --- a/interface/src/ui/OverlayConductor.cpp +++ b/interface/src/ui/OverlayConductor.cpp @@ -114,17 +114,8 @@ void OverlayConductor::setEnabled(bool enabled) { _enabled = enabled; // set the new value - if (!_enabled) { - // alpha fadeOut the overlay mesh. - qApp->getApplicationCompositor().fadeOut(); - - // disable mouse clicks from script - qApp->getOverlays().disable(); - - // disable QML events - auto offscreenUi = DependencyManager::get(); - offscreenUi->getRootItem()->setEnabled(false); - } else { + // if the new state is visible/enabled... + if (_enabled) { // alpha fadeIn the overlay mesh. qApp->getApplicationCompositor().fadeIn(); @@ -144,6 +135,16 @@ void OverlayConductor::setEnabled(bool enabled) { t.setRotation(glm::quat_cast(camMat)); qApp->getApplicationCompositor().setModelTransform(t); } + } else { // other wise, if the new state is hidden/not enabled + // alpha fadeOut the overlay mesh. + qApp->getApplicationCompositor().fadeOut(); + + // disable mouse clicks from script + qApp->getOverlays().disable(); + + // disable QML events + auto offscreenUi = DependencyManager::get(); + offscreenUi->getRootItem()->setEnabled(false); } }