Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #409 from paritytech/luke-408-fix-window-resize
Browse files Browse the repository at this point in the history
fix: Fixes #408 window resize by converting args[0] height to integer for setContentSize
  • Loading branch information
amaury1093 authored Feb 8, 2019
2 parents 971052c + 921398d commit 54c0a23
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/fether-electron/src/main/app/messages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ export default async (fetherAppWindow, event, action, ...args) => {
}
switch (action) {
case 'app-resize': {
if (!args[0]) {
return;
}
const [width] = fetherAppWindow.getContentSize();
const newHeight = args[0];
// Conversion to integer is required to pass as argument to setContentSize.
// Reference: https://electronjs.org/docs/all#winsetcontentsizewidth-height-animate
const newHeight = parseInt(args[0]);
const feedbackButtonHeight = 20;
const resizeHeight = newHeight + 2;
const height =
process.platform === 'win32' && fetherAppWindow.isMenuBarVisible()
? resizeHeight + feedbackButtonHeight
: resizeHeight;
const resizeWithAnimation = true;

fetherAppWindow.setContentSize(width, height);
fetherAppWindow.setContentSize(width, height, resizeWithAnimation);
break;
}
case 'check-clock-sync': {
Expand Down

0 comments on commit 54c0a23

Please sign in to comment.