From c28048be4745ea24ce3389e8f84aa5d75175751f Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Fri, 23 Feb 2024 22:19:57 -0500 Subject: [PATCH 1/2] 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", )) --- scripts/system/notifications.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/system/notifications.js b/scripts/system/notifications.js index aaf1f1e6af..24fada32bc 100644 --- a/scripts/system/notifications.js +++ b/scripts/system/notifications.js @@ -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 }; From af4589d42ad8cd146dc782fa7dab5b725aa624a4 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:49:44 -0500 Subject: [PATCH 2/2] Small adjustments --- scripts/system/notifications.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/notifications.js b/scripts/system/notifications.js index 24fada32bc..fec9fb2341 100644 --- a/scripts/system/notifications.js +++ b/scripts/system/notifications.js @@ -45,8 +45,8 @@ //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": 0.4, "y": 0.25, "z": -1.5}; - var hmdPanelLocalRotation = Quat.fromVec3Degrees({"x": 0, "y": -5, "z": 0}); + var hmdPanelLocalPosition = {"x": 0.3, "y": 0.25, "z": -1.5}; + var hmdPanelLocalRotation = Quat.fromVec3Degrees({"x": 0, "y": -3, "z": 0}); var mainHMDnotificationContainerID = Uuid.NULL; var CAMERA_MATRIX_INDEX = -7;