Skip to content

Commit 531cda9

Browse files
committed
#16 マルチビルド対応、PC画面の調整
1 parent 4d07367 commit 531cda9

File tree

3 files changed

+34
-27
lines changed

3 files changed

+34
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@next2d/framework-typescript-template",
33
"description": "Next2D Framework default TypeScript template.",
4-
"version": "2.0.1",
4+
"version": "2.1.0",
55
"homepage": "https://next2d.app",
66
"bugs": "https://github.com/Next2D/framework-typescript-template/issues/new",
77
"author": "Toshiyuki Ienaga<ienaga@next2d.app>",

template/electron.js

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "1";
22

3-
const { app, BrowserWindow } = require("electron");
3+
const { app, screen, BrowserWindow } = require("electron");
44

55
/**
66
* 自動生成ファイルの読み込み
@@ -12,9 +12,12 @@ app.commandLine.appendSwitch("disable-http-cache");
1212

1313
const createWindow = () =>
1414
{
15+
const primaryDisplay = screen.getPrimaryDisplay();
16+
const { width, height } = primaryDisplay.workAreaSize;
17+
1518
const browserWindow = new BrowserWindow({
16-
"fullscreen": true,
17-
"autoHideMenuBar": false,
19+
"width": width,
20+
"height": height,
1821
"webPreferences": {
1922
"nodeIntegration": false
2023
}
@@ -28,26 +31,30 @@ const createWindow = () =>
2831
browserWindow.loadFile(config.path);
2932
};
3033

31-
app.whenReady().then(createWindow);
32-
33-
app.on("window-all-closed", () =>
34-
{
35-
/**
36-
* windowsならアプリを終了、macならdockに滞在
37-
* Exit apps if windows, stay in dock if mac
38-
*/
39-
if (process.platform !== "darwin") {
40-
app.quit();
41-
}
42-
});
34+
app
35+
.whenReady()
36+
.then(createWindow);
37+
38+
app
39+
.on("window-all-closed", () =>
40+
{
41+
/**
42+
* windowsならアプリを終了、macならdockに滞在
43+
* Exit apps if windows, stay in dock if mac
44+
*/
45+
if (process.platform !== "darwin") {
46+
app.quit();
47+
}
48+
});
4349

44-
app.on("activate", () =>
45-
{
46-
/**
47-
* アプリで起動している画面がなければアプリを起動
48-
* If there is no screen running on the application, start the application.
49-
*/
50-
if (BrowserWindow.getAllWindows().length === 0) {
51-
createWindow();
52-
}
53-
});
50+
app
51+
.on("activate", () =>
52+
{
53+
/**
54+
* アプリで起動している画面がなければアプリを起動
55+
* If there is no screen running on the application, start the application.
56+
*/
57+
if (BrowserWindow.getAllWindows().length === 0) {
58+
createWindow();
59+
}
60+
});

template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
"vite": "^4.5.0",
3636
"vitest": "^0.34.6"
3737
}
38-
}
38+
}

0 commit comments

Comments
 (0)