mirror of
https://github.com/bitwarden/browser
synced 2026-02-10 21:50:15 +00:00
adress position feedback
This commit is contained in:
@@ -9,14 +9,6 @@ const popupHeight = 500;
|
||||
export function applyPopupModalStyles(window: BrowserWindow, position?: [number, number]) {
|
||||
window.unmaximize();
|
||||
window.setSize(popupWidth, popupHeight);
|
||||
|
||||
if (position) {
|
||||
const centeredX = position[0] - popupWidth / 2;
|
||||
const centeredY = position[1] - popupHeight / 2;
|
||||
window.setPosition(centeredX, centeredY);
|
||||
} else {
|
||||
window.center();
|
||||
}
|
||||
window.setWindowButtonVisibility?.(false);
|
||||
window.setMenuBarVisibility?.(false);
|
||||
window.setResizable(false);
|
||||
@@ -27,15 +19,21 @@ export function applyPopupModalStyles(window: BrowserWindow, position?: [number,
|
||||
window.setFullScreen(false);
|
||||
window.once("leave-full-screen", () => {
|
||||
window.setSize(popupWidth, popupHeight);
|
||||
window.center();
|
||||
if (position) {
|
||||
const centeredX = position[0] - popupWidth / 2;
|
||||
const centeredY = position[1] - popupHeight / 2;
|
||||
window.setPosition(centeredX, centeredY);
|
||||
} else {
|
||||
window.center();
|
||||
}
|
||||
positionWindow(window, position);
|
||||
});
|
||||
} else {
|
||||
// If not in full screen
|
||||
positionWindow(window, position);
|
||||
}
|
||||
}
|
||||
|
||||
function positionWindow(window: BrowserWindow, position?: [number, number]) {
|
||||
if (position) {
|
||||
const centeredX = position[0] - popupWidth / 2;
|
||||
const centeredY = position[1] - popupHeight / 2;
|
||||
window.setPosition(centeredX, centeredY);
|
||||
} else {
|
||||
window.center();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user