Skip to content

Commit

Permalink
fix: main window is not show center of the screen
Browse files Browse the repository at this point in the history
close #98
  • Loading branch information
buqiyuan committed Jul 19, 2022
1 parent 4790c2d commit 8107bd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"content-disposition": "^0.5.4",
"copyfiles": "2.4.1",
"crypto-js": "^4.1.1",
"dotenv": "16.0.1",
"electron-log": "^4.4.8",
"electron-store": "8.0.2",
"electron-updater": "^5.0.5",
Expand All @@ -56,7 +57,6 @@
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"dmg-builder": "23.2.0",
"dotenv": "16.0.1",
"dotenv-webpack": "8.0.0",
"electron": "19.0.6",
"electron-builder": "23.1.0",
Expand Down
10 changes: 6 additions & 4 deletions src/app/electron-main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ class EoBrowserWindow {
}
public create(): BrowserWindow {
const size = screen.getPrimaryDisplay().workAreaSize;
const width = Math.floor(size.width * 0.85);
const height = Math.floor(size.height * 0.85);
// Create the browser window.
this.win = new BrowserWindow({
width: Math.round(size.width * 0.85),
height: Math.round(size.height * 0.85),
minWidth: 1280,
minHeight: 720,
width,
height,
minWidth: Math.min(width, 1280),
minHeight: Math.min(height, 720),
useContentSize: true, // 这个要设置,不然计算显示区域尺寸不准
frame: os.type() === 'Darwin' ? true : false, //mac use default frame
webPreferences: {
Expand Down

0 comments on commit 8107bd4

Please sign in to comment.