BUGFIX: Fix wrong zoom factor in Electron app (#1245)

This commit is contained in:
catloversg
2024-05-07 00:13:56 +07:00
committed by GitHub
parent 478646290e
commit a79d7f9e45
3 changed files with 8 additions and 2 deletions

View File

@@ -44,6 +44,9 @@ async function createWindow(killall) {
window.removeMenu();
noScripts = killall ? { query: { noScripts: killall } } : {};
window.loadFile("index.html", noScripts);
window.once("ready-to-show", () => {
utils.setZoomFactor(window, utils.getZoomFactor());
});
window.show();
if (debug) window.webContents.openDevTools();
@@ -60,7 +63,6 @@ async function createWindow(killall) {
achievements.enableAchievementsInterval(window);
utils.attachUnresponsiveAppHandler(window);
utils.setZoomFactor(window);
try {
await api.initialize(window);

View File

@@ -212,7 +212,7 @@ function getMenu(window) {
click: () => window.loadFile("index.html"),
},
{
label: "Reload & Kill All Scripts",
label: "Reload && Kill All Scripts",
click: () => utils.reloadAndKill(window, true),
},
],

View File

@@ -7,8 +7,12 @@ const store = new Store();
function reloadAndKill(window, killScripts) {
log.info("Reloading & Killing all scripts...");
const zoomFactor = getZoomFactor();
window.webContents.forcefullyCrashRenderer();
window.loadFile("index.html", killScripts ? { query: { noScripts: true } } : {});
window.once("ready-to-show", () => {
setZoomFactor(window, zoomFactor);
});
}
function promptForReload(window) {