Skip to content

Commit 2af6170

Browse files
#RI-5051 - fix screen size
1 parent f5e1b4a commit 2af6170

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

redisinsight/desktop/src/lib/window/browserWindow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { v4 as uuidv4 } from 'uuid'
55
import { IParsedDeepLink } from 'desktopSrc/lib/app/deep-link.handlers'
66
import { configMain as config } from 'desktopSrc/config'
77
import { electronStore, updateTray } from 'desktopSrc/lib'
8-
import { resolveHtmlPath, getFitedBounds } from 'desktopSrc/utils'
8+
import { resolveHtmlPath, getFittedBounds } from 'desktopSrc/utils'
99
import { ElectronStorageItem } from 'uiSrc/electron/constants'
1010
import { initWindowHandlers } from './window.handlers'
1111

@@ -72,7 +72,7 @@ export const createWindow = async ({
7272

7373
const savedBounds = electronStore?.get(ElectronStorageItem.bounds)
7474
if (!isNewMainWindow && savedBounds) {
75-
const bounds = getFitedBounds(savedBounds as Rectangle)
75+
const bounds = getFittedBounds(savedBounds as Rectangle)
7676
if (bounds) {
7777
newWindow.setBounds(bounds)
7878
}

redisinsight/desktop/src/utils/window-size.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Rectangle, screen } from 'electron'
22

3-
export const getFitedBounds = (bounds: Rectangle): Rectangle | null => {
3+
export const getFittedBounds = (bounds: Rectangle): Rectangle | null => {
44
try {
5-
const options: Rectangle = { ...bounds }
5+
const options: any = {}
66
const area = screen.getDisplayMatching(bounds).workArea
77

88
if (
@@ -13,17 +13,18 @@ export const getFitedBounds = (bounds: Rectangle): Rectangle | null => {
1313
) {
1414
options.x = bounds.x
1515
options.y = bounds.y
16-
}
16+
} else return null
17+
1718
// If the saved size is still valid, use it.
1819
if (bounds.width <= area.width) {
1920
options.width = bounds.width
20-
}
21+
} else return null
2122

2223
if (bounds.height <= area.height) {
2324
options.height = bounds.height
24-
}
25+
} else return null
2526

26-
return options
27+
return options as Rectangle
2728
} catch {
2829
return null
2930
}

0 commit comments

Comments
 (0)