mirror of
https://github.com/sascha-hemi/homeassistant-desktop.git
synced 2026-03-21 00:04:12 +01:00
Merge pull request #63 from featherbear/master
Fix popup positioning for non-zero y screen configurations
This commit is contained in:
21
app.js
21
app.js
@@ -99,8 +99,8 @@ const changePosition = () => {
|
||||
const windowBounds = window.getBounds();
|
||||
const displayWorkArea = screen.getDisplayNearestPoint({
|
||||
x: trayBounds.x,
|
||||
y: trayBounds.y,
|
||||
}).workAreaSize;
|
||||
y: trayBounds.y
|
||||
}).workArea
|
||||
const taskBarPosition = Positioner.getTaskbarPosition(trayBounds);
|
||||
|
||||
if (taskBarPosition == "top" || taskBarPosition == "bottom") {
|
||||
@@ -119,16 +119,23 @@ const changePosition = () => {
|
||||
trayBounds,
|
||||
alignment
|
||||
);
|
||||
window.setPosition(displayWorkArea.width - windowBounds.width, y, false);
|
||||
|
||||
window.setPosition(
|
||||
displayWorkArea.width - windowBounds.width + displayWorkArea.x,
|
||||
y + (taskBarPosition == 'bottom' && displayWorkArea.y),
|
||||
false
|
||||
)
|
||||
}
|
||||
} else {
|
||||
const alignment = { x: taskBarPosition, y: "center" };
|
||||
if (
|
||||
trayBounds.y + (trayBounds.height + windowBounds.height) / 2 <
|
||||
displayWorkArea.height
|
||||
)
|
||||
Positioner.position(window, trayBounds, alignment);
|
||||
else {
|
||||
) {
|
||||
const {x, y} = Positioner.calculate(window.getBounds(), trayBounds, alignment)
|
||||
window.setPosition(x + (taskBarPosition == 'right' && displayWorkArea.x), y)
|
||||
|
||||
} else {
|
||||
const { x } = Positioner.calculate(
|
||||
window.getBounds(),
|
||||
trayBounds,
|
||||
@@ -136,7 +143,7 @@ const changePosition = () => {
|
||||
);
|
||||
window.setPosition(
|
||||
x,
|
||||
displayWorkArea.height - windowBounds.height,
|
||||
displayWorkArea.y + displayWorkArea.height - windowBounds.height,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user