Skip to content

Commit 49d3ad6

Browse files
committed
Initial commit
1 parent 2ea8a01 commit 49d3ad6

18 files changed

Lines changed: 13775 additions & 1 deletion

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GNU GENERAL PUBLIC LICENSE
1+
GNU GENERAL PUBLIC LICENSE
22
Version 3, 29 June 2007
33

44
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>

main.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
const {shell, app, BrowserWindow, Menu, dialog} = require('electron');
2+
3+
global.arguments = process.argv;
4+
5+
function createWindow()
6+
{
7+
var win = new BrowserWindow({
8+
width: 800,
9+
height: 600,
10+
webPreferences: {
11+
nodeIntegration: true,
12+
enableRemoteModule: true
13+
},
14+
title: "Mesh Viewer",
15+
icon: __dirname + "/src/icon.png"
16+
});
17+
18+
var menu = [
19+
{
20+
label: "File",
21+
submenu: [
22+
{
23+
label: "Open 3D File",
24+
click: () => {
25+
dialog.showOpenDialog({
26+
title: "Select an 3D file",
27+
filters: [{
28+
name: 'OBJ File with MTL',
29+
extensions: ['obj']
30+
}],
31+
properties: ['openFile']
32+
}).then(result => {
33+
if(result.filePaths.length > 0){
34+
let file = result.filePaths[0];
35+
win.webContents.send("open", file);
36+
}
37+
});
38+
}
39+
},
40+
{
41+
label: "Quit",
42+
role: "quit"
43+
}
44+
],
45+
},
46+
{
47+
label: "Help",
48+
submenu: [
49+
{
50+
label: "Toggle Developer Tools",
51+
role: "toggleDevTools"
52+
},
53+
{
54+
label: "GitHub Repository",
55+
click: () => {
56+
shell.openExternal("https://github.com/rbfraphael/meshviewer");
57+
}
58+
},
59+
{
60+
label: "About",
61+
click: () => {
62+
let msg = "Created by: RBFraphael (rbfraphael.com.br)";
63+
msg += "\nVersion: 0.1.0";
64+
msg += "\nRepository: github.com/rbfraphael/meshviewer";
65+
dialog.showMessageBox(win, {
66+
title: "About Mesh Viewer",
67+
message: msg,
68+
buttons: ['Thanks!']
69+
});
70+
}
71+
}
72+
],
73+
}
74+
];
75+
76+
var winMenu = Menu.buildFromTemplate(menu);
77+
Menu.setApplicationMenu(winMenu);
78+
79+
win.loadFile(__dirname + "/src/index.html");
80+
}
81+
82+
app.whenReady().then(createWindow);
83+
84+
app.on("window-all-closed", () => {
85+
if(process.platform != "darwin"){
86+
app.quit();
87+
}
88+
});
89+
90+
app.on("activate", () => {
91+
if(BrowserWindow.getAllWindows().length == 0){
92+
createWindow();
93+
}
94+
});

0 commit comments

Comments
 (0)