fix default settings and window resizing
This commit is contained in:
parent
454ee6cf4c
commit
67ef2abb24
@ -40,16 +40,7 @@ export default () => {
|
||||
});
|
||||
|
||||
ipcMain.handle("local-app:getServers", () => {
|
||||
return (
|
||||
settings.get("servers") || [
|
||||
// TODO: remove this default server
|
||||
{
|
||||
_id: `${Date.now()}-1`,
|
||||
name: "WA Demo",
|
||||
url: "https://play.staging.workadventu.re/@/tcm/workadventure/wa-village",
|
||||
},
|
||||
]
|
||||
);
|
||||
return settings.get("servers");
|
||||
});
|
||||
|
||||
ipcMain.handle("local-app:selectServer", (event, serverId: string) => {
|
||||
|
@ -14,7 +14,13 @@ let settings: SettingsData;
|
||||
const defaultSettings: SettingsData = {
|
||||
log_level: "info",
|
||||
auto_launch_enabled: true,
|
||||
servers: [],
|
||||
servers: [
|
||||
{
|
||||
_id: `${Date.now()}-1`,
|
||||
name: "WA Demo",
|
||||
url: "https://play.staging.workadventu.re/@/tcm/workadventure/wa-village",
|
||||
},
|
||||
],
|
||||
shortcuts: {
|
||||
mute_toggle: "",
|
||||
camera_toggle: "",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BrowserView, BrowserWindow } from "electron";
|
||||
import { BrowserView, BrowserWindow, app } from "electron";
|
||||
import electronIsDev from "electron-is-dev";
|
||||
import windowStateKeeper from "electron-window-state";
|
||||
import path from "path";
|
||||
@ -7,7 +7,7 @@ import { loadCustomScheme } from "./serve";
|
||||
let mainWindow: BrowserWindow | undefined;
|
||||
let appView: BrowserView | undefined;
|
||||
|
||||
const sidebarWidth = 70;
|
||||
const sidebarWidth = 75;
|
||||
|
||||
export function getWindow() {
|
||||
return mainWindow;
|
||||
@ -22,11 +22,13 @@ function resizeAppView() {
|
||||
return;
|
||||
}
|
||||
|
||||
const { width, height } = mainWindow.getBounds();
|
||||
|
||||
appView.setBounds({
|
||||
x: sidebarWidth,
|
||||
y: 0,
|
||||
width: mainWindow.getBounds().width - sidebarWidth,
|
||||
height: mainWindow.getBounds().height,
|
||||
width: width - sidebarWidth,
|
||||
height: height,
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,7 +91,17 @@ export async function createWindow() {
|
||||
},
|
||||
});
|
||||
resizeAppView();
|
||||
appView.setAutoResize({ width: true, height: true });
|
||||
|
||||
// TODO: workaround to fix appView resizing when window is resized
|
||||
mainWindow.on("maximize", resizeAppView);
|
||||
mainWindow.on("unmaximize", resizeAppView);
|
||||
mainWindow.on("minimize", resizeAppView);
|
||||
mainWindow.on("restore", resizeAppView);
|
||||
mainWindow.on("resize", resizeAppView);
|
||||
mainWindow.on("show", resizeAppView);
|
||||
mainWindow.on("enter-full-screen", resizeAppView);
|
||||
mainWindow.on("leave-full-screen", resizeAppView);
|
||||
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
mainWindow?.show();
|
||||
|
Loading…
Reference in New Issue
Block a user