Skip to content

Commit dcaf5a4

Browse files
vcapretzgdelavald
authored andcommitted
[FIX] Fix error caused by window having decimal size
the window size (height/widhth, x/y) should all be integers if window tried to load with float numbers it was throwing errors on the main process.
1 parent ed15647 commit dcaf5a4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/background/windowState.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import _ from 'lodash';
99
export default function (name, defaults) {
1010

1111
const userDataDir = jetpack.cwd(app.getPath('userData'));
12-
const stateStoreFile = 'window-state-' + name +'.json';
12+
const stateStoreFile = `window-state-${name}.json`;
1313
let state = {
1414
width: defaults.width,
1515
height: defaults.height
@@ -41,10 +41,10 @@ export default function (name, defaults) {
4141
};
4242

4343
return {
44-
get x () { return state.x; },
45-
get y () { return state.y; },
46-
get width () { return state.width; },
47-
get height () { return state.height; },
44+
get x () { return Math.floor(state.x); },
45+
get y () { return Math.floor(state.y); },
46+
get width () { return Math.floor(state.width); },
47+
get height () { return Math.floor(state.height); },
4848
get isMaximized () { return state.isMaximized; },
4949
get isMinimized () { return state.isMinimized; },
5050
get isHidden () { return state.isHidden; },

src/helpers/window.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export default function (name, options) {
3131
const position = win.getPosition();
3232
const size = win.getSize();
3333
return {
34-
x: position[0],
35-
y: position[1],
36-
width: size[0],
37-
height: size[1]
34+
x: Math.floor(position[0]),
35+
y: Math.floor(position[1]),
36+
width: Math.floor(size[0]),
37+
height: Math.floor(size[1])
3838
};
3939
};
4040

0 commit comments

Comments
 (0)