From 27e4e1c245458a86d97d119228933a650d7818fc Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 5 Dec 2018 11:24:06 -0800 Subject: [PATCH] pitch updates login pos/fix signup errors --- .../qml/LoginDialog/LinkAccountBody.qml | 2 +- .../qml/LoginDialog/LoggingInBody.qml | 2 +- .../resources/qml/LoginDialog/SignUpBody.qml | 28 +++++++++---------- interface/src/Application.cpp | 13 ++++++--- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index fe6853b1c4..07b0e910f5 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -140,7 +140,7 @@ Item { styleRenderType: Text.QtRendering anchors { top: parent.top - topMargin: loginErrorMessage.height + topMargin: errorContainer.height } placeholderText: "Username or Email" activeFocusOnPress: true diff --git a/interface/resources/qml/LoginDialog/LoggingInBody.qml b/interface/resources/qml/LoginDialog/LoggingInBody.qml index eca58c6441..32b9ec431c 100644 --- a/interface/resources/qml/LoginDialog/LoggingInBody.qml +++ b/interface/resources/qml/LoginDialog/LoggingInBody.qml @@ -102,7 +102,7 @@ Item { } else if (loggingInBody.withOculus) { // reset the flag. loggingInGlyph.visible = false; - loggingInText.text = "You are now logged into Oculus!" + loggingInText.text = "You are now logged into Oculus!" loggingInText.anchors.centerIn = loggingInHeader; loggingInText.anchors.bottom = loggingInHeader.bottom; loggedInGlyph.text = hifi.glyphs.oculus; diff --git a/interface/resources/qml/LoginDialog/SignUpBody.qml b/interface/resources/qml/LoginDialog/SignUpBody.qml index 9ac4075e23..df50bb97f1 100644 --- a/interface/resources/qml/LoginDialog/SignUpBody.qml +++ b/interface/resources/qml/LoginDialog/SignUpBody.qml @@ -64,22 +64,14 @@ Item { } } - function login() { + function signup() { loginDialog.signup(emailField.text, usernameField.text, passwordField.text); return; - bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "withOculus": false, "linkSteam": false }); } function init() { // going to/from sign in/up dialog. loginDialog.isLogIn = false; - loginErrorMessage.visible = (signUpBody.errorString !== ""); - if (signUpBody.errorString !== "") { - loginErrorMessage.text = signUpBody.errorString; - errorContainer.anchors.bottom = usernameField.top; - errorContainer.anchors.bottomMargin = hifi.dimensions.contentSpacing.y; - errorContainer.anchors.left = usernameField.left; - } emailField.placeholderText = "Email"; emailField.text = ""; emailField.anchors.top = usernameField.bottom; @@ -133,7 +125,7 @@ Item { Item { id: errorContainer - width: loginErrorMessageTextMetrics.width + width: parent.width height: loginErrorMessageTextMetrics.height anchors { bottom: usernameField.top; @@ -147,6 +139,7 @@ Item { } Text { id: loginErrorMessage; + width: root.bannerWidth color: "red"; font.family: signUpBody.fontFamily font.pixelSize: 18 @@ -192,7 +185,7 @@ Item { if (keepMeLoggedInCheckbox.checked) { Settings.setValue("keepMeLoggedIn/savedUsername", usernameField.text); } - signUpBody.login(); + signUpBody.signup(); break; } } @@ -235,7 +228,7 @@ Item { if (keepMeLoggedInCheckbox.checked) { Settings.setValue("keepMeLoggedIn/savedUsername", usernameField.text); } - signUpBody.login(); + signUpBody.signup(); break; } } @@ -319,7 +312,7 @@ Item { if (keepMeLoggedInCheckbox.checked) { Settings.setValue("keepMeLoggedIn/savedUsername", usernameField.text); } - signUpBody.login(); + signUpBody.signup(); break; } } @@ -387,7 +380,7 @@ Item { } onClicked: { - signUpBody.login() + signUpBody.signup(); } } } @@ -442,6 +435,13 @@ Item { loginErrorMessage.visible = (errorStringEdited !== ""); if (errorStringEdited !== "") { loginErrorMessage.text = errorStringEdited; + loginErrorMessageTextMetrics.text = errorStringEdited; + if (loginErrorMessageTextMetrics.width > 350 && root.isTablet) { + loginErrorMessage.wrapMode = Text.WordWrap; + loginErrorMessage.verticalAlignment = Text.AlignLeft; + loginErrorMessage.horizontalAlignment = Text.AlignLeft; + errorContainer.height = 2 * loginErrorMessageTextMetrics.height; + } errorContainer.anchors.bottom = usernameField.top; errorContainer.anchors.left = usernameField.left; } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c4d9da1512..bdffcec2a8 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -8656,11 +8656,13 @@ void Application::createLoginDialogOverlay() { } void Application::updateLoginDialogOverlayPosition() { - auto overlayPosition = getOverlays().getProperty(_loginDialogOverlayID, "position"); + const float LOOK_AWAY_THRESHOLD_ANGLE = 40.0f; + auto& overlays = getOverlays(); + auto overlayPosition = overlays.getProperty(_loginDialogOverlayID, "position"); auto overlayPositionVec = vec3FromVariant(overlayPosition.value); auto cameraPositionVec = _myCamera.getPosition(); auto cameraOrientation = _myCamera.getOrientation(); - cameraOrientation = cancelOutRollAndPitch(cameraOrientation); + cameraOrientation = cancelOutRoll(cameraOrientation); auto headLookVec = (cameraOrientation * Vectors::FRONT); auto overlayToHeadVec = overlayPositionVec - cameraPositionVec; auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI); @@ -8669,12 +8671,15 @@ void Application::updateLoginDialogOverlayPosition() { auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * -0.1f); auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180; - if (pointAngle > 40.0f) { + //auto isOverlayTooFar = (glm::distance(overlayPositionVec, getMyAvatar()->getWorldPosition()) > 1.0f); + + //if (pointAngle > LOOK_AWAY_THRESHOLD_ANGLE || isOverlayTooFar) { + if (pointAngle > LOOK_AWAY_THRESHOLD_ANGLE) { QVariantMap properties { {"position", vec3toVariant(newOverlayPositionVec)}, {"orientation", quatToVariant(newOverlayOrientation)} }; - getOverlays().editOverlay(_loginDialogOverlayID, properties); + overlays.editOverlay(_loginDialogOverlayID, properties); } }