CR feedback

This commit is contained in:
Brad Hefta-Gaub 2016-02-25 22:01:10 -08:00
parent e58081ca9c
commit bf0fb7258a
2 changed files with 16 additions and 14 deletions

View file

@ -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) {

View file

@ -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>();
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>();
offscreenUi->getRootItem()->setEnabled(false);
}
}