Added HMD notifications dismissal

Added a gestural way to dismiss the notifications in HMD.

The notifications vanishes after 10 sec. 
But if for any reason we want to accelerate the process (mostly because it hide the view or it is going to appears in photo capture)
In Desktop we can simply click on the notification to get rid of them.
But in HMD, clicking was kinda a pain (assuming the if you want to dismiss the notification is often because they are already annoying you)
have to aim and click is like pressing a button using a fishing pole, it's certainly adding more annoyance to this.
To addressed that, I introduced the "Whoosh!": An easy gesture to dismiss any 3d UI, by simply move one of you controller over you eyes height. (a bit like making flee an annoying fly.)
This commit is contained in:
Alezia Kurdis 2022-09-16 22:29:02 -04:00 committed by GitHub
parent 3e7854a034
commit 4a49631007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,10 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
(function () {
Script.include([
"create/audioFeedback/audioFeedback.js"
]);
var NOTIFICATIONS_MESSAGE_CHANNEL = "Hifi-Notifications";
var SETTING_ACTIVATION_SNAPSHOT_NOTIFICATIONS = "snapshotNotifications";
var NOTIFICATION_LIFE_DURATION = 10000; //10 seconds (in millisecond) before expiration.
@ -54,7 +58,7 @@
function mousePressEvent(event) {
if (!isOnHMD) {
var clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
for (i = 0; i < notifications.length; i += 1) {
for (var i = 0; i < notifications.length; i += 1) {
if (clickedOverlay === notifications[i].overlayID || clickedOverlay === notifications[i].imageOverlayID) {
deleteSpecificNotification(i);
notifications.splice(i, 1);
@ -64,6 +68,19 @@
}
}
function checkHands() {
var myLeftHand = Controller.getPoseValue(Controller.Standard.LeftHand);
var myRightHand = Controller.getPoseValue(Controller.Standard.RightHand);
var eyesPosition = MyAvatar.getEyePosition();
var hipsPosition = MyAvatar.getJointPosition("Hips");
var eyesRelativeHeight = eyesPosition.y - hipsPosition.y;
if (myLeftHand.translation.y > eyesRelativeHeight || myRightHand.translation.y > eyesRelativeHeight) {
deleteAllExistingNotificationsDisplayed();
notifications = [];
audioFeedback.action();
}
}
//DISPLAY
function renderNotifications(remainingTime) {
var alpha = NOTIFICATION_ALPHA;
@ -310,6 +327,9 @@
newEventDetected = false;
}
}
if (isOnHMD) {
checkHands();
}
}
//NOTIFICATION EVENTS FUNCTIONS