ADD: Smooth resizing!!!

This commit is contained in:
Robert Kossessa
2024-02-02 03:45:37 +01:00
parent e76b17dc07
commit d978ea9874

View File

@@ -11,15 +11,17 @@ if (ess) {
app.quit() app.quit()
} }
const zoomFactor = 0.9 const zoomFactor = 1
const width = 1111
const height = 666
const createWindow = () => { const createWindow = () => {
// Create the browser window. // Create the browser window.
const mainWindow = new BrowserWindow({ const mainWindow = new BrowserWindow({
width: 1000, width: width,
height: 600, height: height,
titleBarStyle: 'hidden', titleBarStyle: 'hidden',
resizable: false, resizable: true,
maximizable: false, maximizable: false,
fullscreenable: false, fullscreenable: false,
center: true, center: true,
@@ -31,9 +33,13 @@ const createWindow = () => {
}, },
}) })
mainWindow.setAspectRatio(width / height)
mainWindow.webContents.on('did-finish-load', () => { mainWindow.webContents.on('did-finish-load', () => {
mainWindow.webContents.setZoomFactor(zoomFactor) mainWindow.webContents.setZoomFactor(zoomFactor)
}) })
mainWindow.on('resize', () => {
mainWindow.webContents.setZoomFactor(zoomFactor * mainWindow.getSize()[0] / width)
})
// and load the index.html of the app. // and load the index.html of the app.
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) { if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {