From abdea63edd524bf39efc9145d5bbf2b9d2a2ad99 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Tue, 3 Sep 2024 12:18:23 +0530 Subject: [PATCH] SDA-4659 - stack based on corner top and bottom (#2192) --- src/renderer/notification-handler.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/renderer/notification-handler.ts b/src/renderer/notification-handler.ts index 3c1f7f86..6517a670 100644 --- a/src/renderer/notification-handler.ts +++ b/src/renderer/notification-handler.ts @@ -164,7 +164,6 @@ export default class NotificationHandler { } let posY; - const stackOffset = 10; // Vertical offset for each stacked notification switch (this.settings.startCorner) { case 'upper-right': @@ -174,7 +173,7 @@ export default class NotificationHandler { if (!windowExists(notificationWindow)) { return; } - const newY = posY + stackOffset * index; + const newY = posY + NOTIFICATION_STACK_HEIGHT * index; const newX = this.settings.firstPos.x; this.setWindowPosition(notificationWindow, newX, newY); }); @@ -186,7 +185,7 @@ export default class NotificationHandler { if (!windowExists(notificationWindow)) { return; } - const newY = posY - stackOffset * index; + const newY = posY - NOTIFICATION_STACK_HEIGHT * index; const newX = this.settings.firstPos.x; this.setWindowPosition(notificationWindow, newX, newY); }); @@ -316,7 +315,21 @@ export default class NotificationHandler { const newX = this.settings.firstPos.x; if (this.isNotificationStacked) { - newY = this.settings.firstPos.y + NOTIFICATION_STACK_HEIGHT * i; + if (isReset) { + switch (this.settings.startCorner) { + case 'upper-right': + case 'upper-left': + newY = this.settings.corner.y + NOTIFICATION_STACK_HEIGHT * i; + break; + case 'lower-right': + case 'lower-left': + const posY = this.settings.firstPos.y; + newY = posY - NOTIFICATION_STACK_HEIGHT * i; + break; + } + } else { + newY = this.settings.firstPos.y + NOTIFICATION_STACK_HEIGHT * i; + } } else { const [, y] = notificationWindow.getPosition();