2

This bug occurs when minimizing and maximizing the window of my application. After every min-/maximizing the window becomes a few pixels shorter. Here are images from before and after I repeated this process a few times.

Before & After

Here is my code for creating the window:

app.on('ready', function(){
    const display = electron.screen.getPrimaryDisplay();
    const maxiSize = display.workAreaSize;

    mainWindow = new BrowserWindow({resizable: false, 
                                    icon: "Media/Magnet_Icon.ico", 
                                    height: maxiSize.height, 
                                    width: maxiSize.width
                                    });


    mainWindow.loadURL(url.format({
        pathname: path.join(__dirname, 'MagnetMain.html'),
        protocol: 'file:',
        slashes: true
    }));
});

Any Ideas how to fix this?

Mike W
  • 21
  • 4
  • lol. it also gain width! Definitely an oddity in electron (why maximize is disabled while minimize is not etc). You can work around it by `resizable: true` – pergy Sep 20 '18 at 11:19
  • Alright, do you know if it's possible to set the height again when the "maximize window method" is called? Thanks for the response. – Mike W Sep 20 '18 at 12:13
  • I think you mean ['restore'](https://github.com/electron/electron/blob/master/docs/api/browser-window.md#event-restore) and sure you can [setSize](https://github.com/electron/electron/blob/master/docs/api/browser-window.md#winsetsizewidth-height-animate) any time (if it's not disabled by resizable: false, i'm not sure) – pergy Sep 20 '18 at 12:23

0 Answers0