Skip to content

Commit

Permalink
Add constraint in window size
Browse files Browse the repository at this point in the history
  • Loading branch information
g1eny0ung committed Sep 17, 2019
1 parent 7ee3772 commit bf29511
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions electron/ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ ipcMain.on('patternSwitch', (_, arg) => {

ipcMain.on('resizeWindowAfterLoading', () => {
mainWindow.setSize(330, 500)
mainWindow.setMinimumSize(330, 500)
})

ipcMain.on('reInitWindowSize', () => {
mainWindow.setMinimumSize(330, 330)
mainWindow.setSize(330, 330)
})

Expand Down
28 changes: 17 additions & 11 deletions electron/win.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ export let mainWindow = null
export const createWindow = () => {
mainWindow = new BrowserWindow({
width: 330,
minWidth: 250,
minHeight: 385,
height: 330,
minWidth: 330,
minHeight: 330,
maxWidth: 430,
maxHeight: 800,
resizable: true,
frame: false,
show: false,
Expand Down Expand Up @@ -66,13 +68,17 @@ export function setWindowPostionFromDB() {
}

export function saveCurrentWindowPosition() {
db.update({
window: 'position'
}, {
window: 'position',
pos: getCurrentWindowPostion()
}, {
multi: false,
upsert: true
})
db.update(
{
window: 'position'
},
{
window: 'position',
pos: getCurrentWindowPostion()
},
{
multi: false,
upsert: true
}
)
}

0 comments on commit bf29511

Please sign in to comment.