Open and close avatar selector with Ctrl-A

This commit is contained in:
David Rowe 2015-04-22 09:16:15 -07:00
parent 24178b72fb
commit 63d0efcdec
2 changed files with 25 additions and 10 deletions

View file

@ -89,7 +89,7 @@ var DRONE_VOLUME = 0.3;
function drawLobby() { function drawLobby() {
if (!panelWall) { if (!panelWall) {
print("Adding overlays for the lobby panel wall and orb shell."); print("Adding overlays for the avatar selector panel wall and orb shell.");
var cameraEuler = Quat.safeEulerAngles(Camera.orientation); var cameraEuler = Quat.safeEulerAngles(Camera.orientation);
var towardsMe = Quat.angleAxis(cameraEuler.y + 180, { x: 0, y: 1, z: 0 }); var towardsMe = Quat.angleAxis(cameraEuler.y + 180, { x: 0, y: 1, z: 0 });
@ -294,7 +294,14 @@ function actionStartEvent(event) {
} }
} }
function backStartEvent() { var control = false;
function keyPressEvent(event) {
if (event.text === "CONTROL") {
control = true;
}
if (control && event.text === "a") {
if (!panelWall) { if (!panelWall) {
toggleEnvironmentRendering(false); toggleEnvironmentRendering(false);
drawLobby(); drawLobby();
@ -303,6 +310,13 @@ function backStartEvent() {
cleanupLobby(); cleanupLobby();
} }
} }
}
function keyReleaseEvent(event) {
if (event.text === "CONTROL") {
control = false;
}
}
var CLEANUP_EPSILON_DISTANCE = 0.05; var CLEANUP_EPSILON_DISTANCE = 0.05;
@ -394,7 +408,8 @@ function mouseMoveEvent(event) {
} }
Controller.actionStartEvent.connect(actionStartEvent); Controller.actionStartEvent.connect(actionStartEvent);
Controller.backStartEvent.connect(backStartEvent); Controller.keyPressEvent.connect(keyPressEvent);
Controller.keyReleaseEvent.connect(keyReleaseEvent);
Script.update.connect(update); Script.update.connect(update);
Script.scriptEnding.connect(maybeCleanupLobby); Script.scriptEnding.connect(maybeCleanupLobby);
Controller.mouseMoveEvent.connect(mouseMoveEvent); Controller.mouseMoveEvent.connect(mouseMoveEvent);

View file

@ -1020,7 +1020,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_A: case Qt::Key_A:
if (isShifted) { if (isShifted) {
Menu::getInstance()->triggerOption(MenuOption::Atmosphere); Menu::getInstance()->triggerOption(MenuOption::Atmosphere);
} else { } else if (!isMeta) {
_myAvatar->setDriveKeys(ROT_LEFT, 1.0f); _myAvatar->setDriveKeys(ROT_LEFT, 1.0f);
} }
break; break;