File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { v4 as uuidv4 } from 'uuid'
5
5
import { IParsedDeepLink } from 'desktopSrc/lib/app/deep-link.handlers'
6
6
import { configMain as config } from 'desktopSrc/config'
7
7
import { electronStore , updateTray } from 'desktopSrc/lib'
8
- import { resolveHtmlPath , getFitedBounds } from 'desktopSrc/utils'
8
+ import { resolveHtmlPath , getFittedBounds } from 'desktopSrc/utils'
9
9
import { ElectronStorageItem } from 'uiSrc/electron/constants'
10
10
import { initWindowHandlers } from './window.handlers'
11
11
@@ -72,7 +72,7 @@ export const createWindow = async ({
72
72
73
73
const savedBounds = electronStore ?. get ( ElectronStorageItem . bounds )
74
74
if ( ! isNewMainWindow && savedBounds ) {
75
- const bounds = getFitedBounds ( savedBounds as Rectangle )
75
+ const bounds = getFittedBounds ( savedBounds as Rectangle )
76
76
if ( bounds ) {
77
77
newWindow . setBounds ( bounds )
78
78
}
Original file line number Diff line number Diff line change 1
1
import { Rectangle , screen } from 'electron'
2
2
3
- export const getFitedBounds = ( bounds : Rectangle ) : Rectangle | null => {
3
+ export const getFittedBounds = ( bounds : Rectangle ) : Rectangle | null => {
4
4
try {
5
- const options : Rectangle = { ... bounds }
5
+ const options : any = { }
6
6
const area = screen . getDisplayMatching ( bounds ) . workArea
7
7
8
8
if (
@@ -13,17 +13,18 @@ export const getFitedBounds = (bounds: Rectangle): Rectangle | null => {
13
13
) {
14
14
options . x = bounds . x
15
15
options . y = bounds . y
16
- }
16
+ } else return null
17
+
17
18
// If the saved size is still valid, use it.
18
19
if ( bounds . width <= area . width ) {
19
20
options . width = bounds . width
20
- }
21
+ } else return null
21
22
22
23
if ( bounds . height <= area . height ) {
23
24
options . height = bounds . height
24
- }
25
+ } else return null
25
26
26
- return options
27
+ return options as Rectangle
27
28
} catch {
28
29
return null
29
30
}
You can’t perform that action at this time.
0 commit comments