Fix notification display

This address the following things:
- In HMD, the notification are now synch with the helmet, you can't miss any notification now. the rendering is more stable this way. (Addressing Issue #826)
- in Desktop, it is using Window API instead of Controller API to obtain the window size to know where to display should be. (Controller is not always on synch with desktop size.  Window is always accurate for Desktop.
- In Desktop, now the windows width is recomputed so it support now window resizing. (Maybe addressing Issue #470 (assuming that "Announcements" are the "Notificatons", ))
This commit is contained in:
Alezia Kurdis 2024-02-23 22:19:57 -05:00 committed by GitHub
parent 68fffe00ab
commit c28048be47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,7 @@
//
// Created by Adrian McCarlie on October 8th, 2014
// Copyright 2014 High Fidelity, Inc.
// Copyright 2022-2023 Overte e.V.
// Copyright 2022-2024 Overte e.V.
//
// Display notifications to the user for some specific events.
//
@ -35,8 +35,7 @@
//DESKTOP OVERLAY PROPERTIES
var overlayWidth = 340.0; //width in pixel of notification overlay in desktop
var windowDimensions = Controller.getViewportDimensions(); // get the size of the interface window
var overlayLocationX = (windowDimensions.x - (overlayWidth + 20.0)); // positions window 20px from the right of the interface window
var overlayLocationX = (Window.innerWidth - (overlayWidth + 20.0)); // positions window 20px from the right of the interface window
var overlayLocationY = 20.0; // position down from top of interface window
var overlayTopMargin = 13.0;
var overlayLeftMargin = 10.0;
@ -46,9 +45,10 @@
//HMD NOTIFICATION PANEL PROPERTIES
var HMD_UI_SCALE_FACTOR = 1.0; //This define the size of all the notification system in HMD.
var hmdPanelLocalPosition = {"x": 1.2, "y": 2, "z": -1.0};
var hmdPanelLocalRotation = Quat.fromVec3Degrees({"x": 0, "y": -15, "z": 0});
var hmdPanelLocalPosition = {"x": 0.4, "y": 0.25, "z": -1.5};
var hmdPanelLocalRotation = Quat.fromVec3Degrees({"x": 0, "y": -5, "z": 0});
var mainHMDnotificationContainerID = Uuid.NULL;
var CAMERA_MATRIX_INDEX = -7;
//HMD LOCAL ENTITY PROPERTIES
var entityWidth = 0.8; //in meter
@ -87,6 +87,7 @@
//DISPLAY
function renderNotifications(remainingTime) {
overlayLocationX = (Window.innerWidth - (overlayWidth + 20.0));
var alpha = NOTIFICATION_ALPHA;
if (remainingTime < FADE_OUT_DURATION) {
alpha = NOTIFICATION_ALPHA * (remainingTime/FADE_OUT_DURATION);
@ -190,7 +191,7 @@
"subImage": { "x": 0, "y": 0 },
"visible": true,
"alpha": alpha
};
};
if (notifications[i].imageOverlayID === Uuid.NULL){
properties.imageURL = notifications[i].dataImage.path;
notifications[i].imageOverlayID = Overlays.addOverlay("image", properties);
@ -239,7 +240,7 @@
"visible": false,
"dimensions": {"x": 0.1, "y": 0.1, "z":0.1},
"parentID": MyAvatar.sessionUUID,
"parentJointIndex": -2,
"parentJointIndex": CAMERA_MATRIX_INDEX,
"localPosition": hmdPanelLocalPosition,
"localRotation": hmdPanelLocalRotation
};