Skip to content

Commit 87fe26b

Browse files
committed
fix: try to fix views bounds/scale bugs
1 parent 56cfc62 commit 87fe26b

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

electron/actions/aboutWindow/create.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ function handleClose (
2727
aboutWindow.hide()
2828
}
2929

30+
function handleFirstShow () {
31+
setAboutViewBounds()
32+
33+
setViewScale(
34+
aboutView
35+
)
36+
}
37+
3038
export default function () {
3139
const aboutWindowWidth = 500
3240
const aboutWindowHeight = 275
@@ -63,16 +71,10 @@ export default function () {
6371
aboutViewOptions
6472
)
6573

66-
setAboutViewBounds()
67-
6874
changeViewBackgroundColor(
6975
aboutView
7076
)
7177

72-
setViewScale(
73-
aboutView
74-
)
75-
7678
aboutWindow
7779
.contentView
7880
.addChildView(
@@ -87,6 +89,11 @@ export default function () {
8789
url
8890
)
8991

92+
aboutWindow.once(
93+
'show',
94+
handleFirstShow
95+
)
96+
9097
aboutWindow.on(
9198
'close',
9299
handleClose

electron/actions/mainWindow/create.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
} from '../../helpers/icons.js'
88
import {
99
isDevelopment,
10-
isLinux,
1110
wait,
1211
isShowDevTools
1312
} from '../../helpers/utils.js'
@@ -79,28 +78,30 @@ function handleFocus () {
7978
}
8079
}
8180

82-
async function handleDidFinishLoad () {
81+
function handleDidFinishLoad () {
82+
showMainWindow()
83+
}
84+
85+
async function handleFirstShow () {
86+
resizeViews()
87+
88+
setViewScale(
89+
mainView
90+
)
91+
8392
const isMaximizeOnStart =
8493
getElectronStoreKey(
8594
'window.isMaximizeOnStart'
8695
)
8796

8897
if (isMaximizeOnStart) {
89-
if (isLinux) {
90-
showMainWindow()
91-
92-
await wait(
93-
100
94-
)
95-
}
98+
await wait(
99+
50
100+
)
96101

97102
mainWindow.maximize()
98-
} else {
99-
showMainWindow()
100103
}
101104

102-
resizeViews()
103-
104105
const isCheckForNewVersions =
105106
getElectronStoreKey(
106107
'updates.isCheckForNewVersions'
@@ -159,10 +160,6 @@ export default function () {
159160
mainView
160161
)
161162

162-
setViewScale(
163-
mainView
164-
)
165-
166163
mainWindow
167164
.contentView
168165
.addChildView(
@@ -175,6 +172,11 @@ export default function () {
175172
baseUrl
176173
)
177174

175+
mainWindow.once(
176+
'show',
177+
handleFirstShow
178+
)
179+
178180
mainWindow.on(
179181
'show',
180182
handleShow

0 commit comments

Comments
 (0)