mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 22:09:02 +02:00
KB following updated login screen/keep login screen active
This commit is contained in:
parent
4f0e23ed69
commit
1ddba8e787
1 changed files with 26 additions and 26 deletions
|
@ -1287,10 +1287,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
dialogsManager->hideLoginDialog();
|
dialogsManager->hideLoginDialog();
|
||||||
createLoginDialogOverlay();
|
createLoginDialogOverlay();
|
||||||
} else {
|
} else {
|
||||||
QVariantMap properties{
|
|
||||||
{ "parentID", QUuid() }
|
|
||||||
};
|
|
||||||
getOverlays().editOverlay(keyboard->getAnchorID(), properties);
|
|
||||||
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
||||||
_loginDialogOverlayID = OverlayID();
|
_loginDialogOverlayID = OverlayID();
|
||||||
_loginStateManager.tearDown();
|
_loginStateManager.tearDown();
|
||||||
|
@ -3789,7 +3785,7 @@ bool Application::event(QEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow focused Entities and Overlays to handle keyboard input
|
// Allow focused Entities and Overlays to handle keyboard input
|
||||||
if (isKeyEvent(event->type()) && handleKeyEventForFocusedEntityOrOverlay(event) && !qApp->getLoginDialogPoppedUp()) {
|
if (isKeyEvent(event->type()) && handleKeyEventForFocusedEntityOrOverlay(event)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3902,10 +3898,6 @@ bool Application::eventFilter(QObject* object, QEvent* event) {
|
||||||
static bool _altPressed{ false };
|
static bool _altPressed{ false };
|
||||||
|
|
||||||
void Application::keyPressEvent(QKeyEvent* event) {
|
void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
if (isHMDMode() && qApp->getLoginDialogPoppedUp()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_altPressed = event->key() == Qt::Key_Alt;
|
_altPressed = event->key() == Qt::Key_Alt;
|
||||||
|
|
||||||
if (!event->isAutoRepeat()) {
|
if (!event->isAutoRepeat()) {
|
||||||
|
@ -4149,10 +4141,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::keyReleaseEvent(QKeyEvent* event) {
|
void Application::keyReleaseEvent(QKeyEvent* event) {
|
||||||
if (isHMDMode() && qApp->getLoginDialogPoppedUp()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!event->isAutoRepeat()) {
|
if (!event->isAutoRepeat()) {
|
||||||
_keysPressed.remove(event->key());
|
_keysPressed.remove(event->key());
|
||||||
}
|
}
|
||||||
|
@ -5683,6 +5671,9 @@ QUuid Application::getKeyboardFocusEntity() const {
|
||||||
static const float FOCUS_HIGHLIGHT_EXPANSION_FACTOR = 1.05f;
|
static const float FOCUS_HIGHLIGHT_EXPANSION_FACTOR = 1.05f;
|
||||||
|
|
||||||
void Application::setKeyboardFocusEntity(const EntityItemID& entityItemID) {
|
void Application::setKeyboardFocusEntity(const EntityItemID& entityItemID) {
|
||||||
|
if (qApp->getLoginDialogPoppedUp()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_keyboardFocusedEntity.get() != entityItemID) {
|
if (_keyboardFocusedEntity.get() != entityItemID) {
|
||||||
_keyboardFocusedEntity.set(entityItemID);
|
_keyboardFocusedEntity.set(entityItemID);
|
||||||
|
|
||||||
|
@ -5723,6 +5714,15 @@ OverlayID Application::getKeyboardFocusOverlay() {
|
||||||
|
|
||||||
void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) {
|
void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) {
|
||||||
if (overlayID != _keyboardFocusedOverlay.get()) {
|
if (overlayID != _keyboardFocusedOverlay.get()) {
|
||||||
|
if (qApp->getLoginDialogPoppedUp()) {
|
||||||
|
if (overlayID == _loginDialogOverlayID) {
|
||||||
|
emit loginDialogFocusEnabled();
|
||||||
|
} else {
|
||||||
|
// that's the only overlay we want in focus;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_keyboardFocusedOverlay.set(overlayID);
|
_keyboardFocusedOverlay.set(overlayID);
|
||||||
|
|
||||||
if (_keyboardFocusHighlight && _keyboardFocusedEntity.get() == UNKNOWN_ENTITY_ID) {
|
if (_keyboardFocusHighlight && _keyboardFocusedEntity.get() == UNKNOWN_ENTITY_ID) {
|
||||||
|
@ -5752,9 +5752,6 @@ void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) {
|
||||||
_keyboardFocusHighlight->setVisible(false);
|
_keyboardFocusHighlight->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (overlayID == _loginDialogOverlayID) {
|
|
||||||
emit loginDialogFocusEnabled();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8649,13 +8646,13 @@ void Application::createLoginDialogOverlay() {
|
||||||
{ "visible", true }
|
{ "visible", true }
|
||||||
};
|
};
|
||||||
auto& overlays = getOverlays();
|
auto& overlays = getOverlays();
|
||||||
_loginDialogOverlayID = getOverlays().addOverlay("web3d", overlayProperties);
|
_loginDialogOverlayID = overlays.addOverlay("web3d", overlayProperties);
|
||||||
|
auto loginOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays.getOverlay(_loginDialogOverlayID));
|
||||||
auto keyboard = DependencyManager::get<Keyboard>().data();
|
auto keyboard = DependencyManager::get<Keyboard>().data();
|
||||||
if (!keyboard->getAnchorID().isNull() && !_loginDialogOverlayID.isNull()) {
|
if (!keyboard->getAnchorID().isNull() && !_loginDialogOverlayID.isNull()) {
|
||||||
QVariantMap properties {
|
QVariantMap properties {
|
||||||
{ "parentID", _loginDialogOverlayID },
|
{ "position", vec3toVariant(loginOverlay->getWorldPosition() + glm::vec3(-0.4, -0.3f, 0.2f)) },
|
||||||
{ "localPosition", vec3toVariant(glm::vec3(-0.3f, -0.3f, 0.2f)) },
|
{ "orientation", quatToVariant(loginOverlay->getWorldOrientation() * glm::quat(0.0f, 0.0, 1.0f, 0.25f)) },
|
||||||
{ "localOrientation", quatToVariant(glm::quat(0.0f, 0.0, 1.0f, 0.25f)) },
|
|
||||||
};
|
};
|
||||||
overlays.editOverlay(keyboard->getAnchorID(), properties);
|
overlays.editOverlay(keyboard->getAnchorID(), properties);
|
||||||
keyboard->setResetKeyboardPositionOnRaise(false);
|
keyboard->setResetKeyboardPositionOnRaise(false);
|
||||||
|
@ -8671,8 +8668,8 @@ void Application::createLoginDialogOverlay() {
|
||||||
void Application::updateLoginDialogOverlayPosition() {
|
void Application::updateLoginDialogOverlayPosition() {
|
||||||
const float LOOK_AWAY_THRESHOLD_ANGLE = 40.0f;
|
const float LOOK_AWAY_THRESHOLD_ANGLE = 40.0f;
|
||||||
auto& overlays = getOverlays();
|
auto& overlays = getOverlays();
|
||||||
auto overlayPosition = overlays.getProperty(_loginDialogOverlayID, "position");
|
auto loginOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays.getOverlay(_loginDialogOverlayID));
|
||||||
auto overlayPositionVec = vec3FromVariant(overlayPosition.value);
|
auto overlayPositionVec = loginOverlay->getWorldPosition();
|
||||||
auto cameraPositionVec = _myCamera.getPosition();
|
auto cameraPositionVec = _myCamera.getPosition();
|
||||||
auto cameraOrientation = _myCamera.getOrientation();
|
auto cameraOrientation = _myCamera.getOrientation();
|
||||||
cameraOrientation = cancelOutRoll(cameraOrientation);
|
cameraOrientation = cancelOutRoll(cameraOrientation);
|
||||||
|
@ -8690,6 +8687,13 @@ void Application::updateLoginDialogOverlayPosition() {
|
||||||
{"orientation", quatToVariant(newOverlayOrientation)}
|
{"orientation", quatToVariant(newOverlayOrientation)}
|
||||||
};
|
};
|
||||||
overlays.editOverlay(_loginDialogOverlayID, properties);
|
overlays.editOverlay(_loginDialogOverlayID, properties);
|
||||||
|
auto keyboardPositionOffsetVec = newOverlayOrientation * glm::vec3(-0.4f * getMyAvatar()->getSensorToWorldScale(), -0.3f, 0.2f);
|
||||||
|
QVariantMap keyboardProperties {
|
||||||
|
{ "position", vec3toVariant(newOverlayPositionVec + keyboardPositionOffsetVec) },
|
||||||
|
{ "orientation", quatToVariant(newOverlayOrientation * glm::quat(0.0f, 0.0, 1.0f, 0.25f)) },
|
||||||
|
};
|
||||||
|
auto keyboard = DependencyManager::get<Keyboard>().data();
|
||||||
|
overlays.editOverlay(keyboard->getAnchorID(), keyboardProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8698,10 +8702,6 @@ void Application::onDismissedLoginDialog() {
|
||||||
loginDialogPoppedUp.set(false);
|
loginDialogPoppedUp.set(false);
|
||||||
auto keyboard = DependencyManager::get<Keyboard>().data();
|
auto keyboard = DependencyManager::get<Keyboard>().data();
|
||||||
if (!_loginDialogOverlayID.isNull()) {
|
if (!_loginDialogOverlayID.isNull()) {
|
||||||
QVariantMap properties{
|
|
||||||
{ "parentID", QUuid() }
|
|
||||||
};
|
|
||||||
getOverlays().editOverlay(keyboard->getAnchorID(), properties);
|
|
||||||
keyboard->setResetKeyboardPositionOnRaise(true);
|
keyboard->setResetKeyboardPositionOnRaise(true);
|
||||||
// deleting overlay.
|
// deleting overlay.
|
||||||
qDebug() << "Deleting overlay";
|
qDebug() << "Deleting overlay";
|
||||||
|
|
Loading…
Reference in a new issue