From 45d8a2e7345d6ff3d913de9dcb154a6c4925c3d9 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Thu, 14 Mar 2019 12:41:00 -0230 Subject: [PATCH] Centre the notification in the current window --- app/scripts/lib/notification-manager.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js index a97e89ffc083..758979973658 100644 --- a/app/scripts/lib/notification-manager.js +++ b/app/scripts/lib/notification-manager.js @@ -25,10 +25,9 @@ class NotificationManager { // bring focus to existing chrome popup extension.windows.update(popup.id, { focused: true }) } else { - const screenWidth = window.screen.width - const screenHeight = window.screen.height - const notificationTop = (screenHeight / 2) - (NOTIFICATION_HEIGHT / 2) - const notificationLeft = (screenWidth / 2) - (NOTIFICATION_WIDTH / 2) + const {screenX, screenY, outerWidth, outerHeight} = window + const notificationTop = screenY + (outerHeight / 2) - (NOTIFICATION_HEIGHT / 2) + const notificationLeft = screenX + (outerWidth / 2) - (NOTIFICATION_WIDTH / 2) const cb = (currentPopup) => { this._popupId = currentPopup.id } // create new notification popup const creation = extension.windows.create({