Skip to content
This repository was archived by the owner on Aug 31, 2020. It is now read-only.

Commit afd2d15

Browse files
committed
Fixed #1
1 parent d92c183 commit afd2d15

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,17 @@ module.exports = class WindowPosition {
8484
* @throws {NotReadyException} fired if electron app module is not ready
8585
*/
8686
getActiveScreenCenter( width, height ){
87+
// make sure, the window opens in a possible position
88+
// huge window can not open centered on small screen
89+
if( this.display.bounds.width < width || this.display.bounds.height < height ){
90+
//use top left as fallback
91+
return this.getActiveScreenTopLeft();
92+
}
93+
8794
// top left position
8895
var topleft = this.getActiveScreenTopLeft();
8996
topleft.x = topleft.x - 20;
90-
topleft.y = topleft.y - 20;
97+
topleft.y = topleft.y - 20;
9198

9299
// calculate center
93100
var center = {

0 commit comments

Comments
 (0)