mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 15:43:17 +02:00
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:
parent
3e7854a034
commit
4a49631007
1 changed files with 21 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue