pitch updates login pos/fix signup errors

This commit is contained in:
Wayne Chen 2018-12-05 11:24:06 -08:00
parent eb51a5b7b6
commit 27e4e1c245
4 changed files with 25 additions and 20 deletions

View file

@ -140,7 +140,7 @@ Item {
styleRenderType: Text.QtRendering
anchors {
top: parent.top
topMargin: loginErrorMessage.height
topMargin: errorContainer.height
}
placeholderText: "Username or Email"
activeFocusOnPress: true

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
}
}