Skip to content

Commit

Permalink
SDA-4659 - stack based on corner top and bottom (#2192)
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranNiranjan authored Sep 3, 2024
1 parent a11f031 commit abdea63
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/renderer/notification-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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);
});
Expand All @@ -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);
});
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit abdea63

Please sign in to comment.