mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-28 09:51:06 -06:00
Electron-171 - Fixes the Configuration window positioning when multiple monitors are connected
This commit is contained in:
parent
b264331a54
commit
4a292ad7c0
@ -72,13 +72,27 @@ function getTemplatePath() {
|
||||
* @param windowName
|
||||
*/
|
||||
function openConfigurationWindow(windowName) {
|
||||
let allWindows = BrowserWindow.getAllWindows();
|
||||
allWindows = allWindows.find((window) => { return window.winName === windowName });
|
||||
const allWindows = BrowserWindow.getAllWindows();
|
||||
const selectedParentWindow = allWindows.find((window) => { return window.winName === windowName });
|
||||
|
||||
// if we couldn't find any window matching the window name
|
||||
// it will render as a new window
|
||||
if (allWindows) {
|
||||
windowConfig.parent = allWindows;
|
||||
if (selectedParentWindow) {
|
||||
windowConfig.parent = selectedParentWindow;
|
||||
|
||||
// This is a temporary work around until there
|
||||
// is a fix for the modal window in windows from the electron
|
||||
const { x, y, width, height } = selectedParentWindow.getBounds();
|
||||
|
||||
const windowWidth = Math.round(width * 0.5);
|
||||
const windowHeight = Math.round(height * 0.5);
|
||||
|
||||
// Calculating the center of the window
|
||||
// to place the configuration window
|
||||
const centerX = x + width / 2.0;
|
||||
const centerY = y + height / 2.0;
|
||||
windowConfig.x = Math.round(centerX - (windowWidth / 2.0));
|
||||
windowConfig.y = Math.round(centerY - (windowHeight / 2.0));
|
||||
}
|
||||
|
||||
configurationWindow = new BrowserWindow(windowConfig);
|
||||
|
Loading…
Reference in New Issue
Block a user