mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
Prettified Code!
This commit is contained in:
1 parent
73fedc7593
commit
3e0654b435
8 files changed
+22
-21
No files matched your search
@@ -17,10 +17,7 @@
|
|||||||
"ecmaVersion": "latest",
|
"ecmaVersion": "latest",
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": ["react", "@typescript-eslint"],
|
||||||
"react",
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"arrow-body-style": "off",
|
"arrow-body-style": "off",
|
||||||
"camelcase": "off",
|
"camelcase": "off",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const path = require("path");
|
const path = require('path');
|
||||||
|
|
||||||
const { app, BrowserWindow } = require("electron");
|
const { app, BrowserWindow } = require('electron');
|
||||||
const isDev = require("electron-is-dev");
|
const isDev = require('electron-is-dev');
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
@@ -17,12 +17,12 @@ function createWindow() {
|
|||||||
// win.loadFile("index.html");
|
// win.loadFile("index.html");
|
||||||
win.loadURL(
|
win.loadURL(
|
||||||
isDev
|
isDev
|
||||||
? "http://localhost:3000"
|
? 'http://localhost:3000'
|
||||||
: `file://${path.join(__dirname, "../build/index.html")}`
|
: `file://${path.join(__dirname, '../build/index.html')}`,
|
||||||
);
|
);
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
win.webContents.openDevTools({ mode: "detach" });
|
win.webContents.openDevTools({ mode: 'detach' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,13 +34,13 @@ app.whenReady().then(createWindow);
|
|||||||
// Quit when all windows are closed, except on macOS. There, it's common
|
// Quit when all windows are closed, except on macOS. There, it's common
|
||||||
// for applications and their menu bar to stay active until the user quits
|
// for applications and their menu bar to stay active until the user quits
|
||||||
// explicitly with Cmd + Q.
|
// explicitly with Cmd + Q.
|
||||||
app.on("window-all-closed", () => {
|
app.on('window-all-closed', () => {
|
||||||
if (process.platform !== "darwin") {
|
if (process.platform !== 'darwin') {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on("activate", () => {
|
app.on('activate', () => {
|
||||||
if (BrowserWindow.getAllWindows().length === 0) {
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
createWindow();
|
createWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,12 @@ export function drawCamera(camera): THREE.Object3D {
|
|||||||
const f = camera.fx;
|
const f = camera.fx;
|
||||||
const displayedFocalLength = height / (2.0 * (camera.cy / f));
|
const displayedFocalLength = height / (2.0 * (camera.cy / f));
|
||||||
const width = 2.0 * (camera.cx / f) * displayedFocalLength;
|
const width = 2.0 * (camera.cx / f) * displayedFocalLength;
|
||||||
const cameraWireframeObject = getCameraWireframe(1.0, displayedFocalLength, width, height);
|
const cameraWireframeObject = getCameraWireframe(
|
||||||
|
1.0,
|
||||||
|
displayedFocalLength,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
);
|
||||||
cameraWireframeObject.translateZ(displayedFocalLength); // move the wireframe frustum back
|
cameraWireframeObject.translateZ(displayedFocalLength); // move the wireframe frustum back
|
||||||
group.add(cameraWireframeObject);
|
group.add(cameraWireframeObject);
|
||||||
const cameraImagePlaneObject = drawCameraImagePlane(
|
const cameraImagePlaneObject = drawCameraImagePlane(
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default function WebRtcWindow() {
|
|||||||
// connect video
|
// connect video
|
||||||
pc.addEventListener('track', (evt) => {
|
pc.addEventListener('track', (evt) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "write",
|
type: 'write',
|
||||||
path: 'webrtcState/isConnected',
|
path: 'webrtcState/isConnected',
|
||||||
data: true,
|
data: true,
|
||||||
});
|
});
|
||||||
@@ -55,13 +55,13 @@ export default function WebRtcWindow() {
|
|||||||
pc.oniceconnectionstatechange = () => {
|
pc.oniceconnectionstatechange = () => {
|
||||||
if (pc.iceConnectionState === 'connected') {
|
if (pc.iceConnectionState === 'connected') {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "write",
|
type: 'write',
|
||||||
path: 'webrtcState/isConnected',
|
path: 'webrtcState/isConnected',
|
||||||
data: true,
|
data: true,
|
||||||
});
|
});
|
||||||
} else if (pc.iceConnectionState === 'disconnected') {
|
} else if (pc.iceConnectionState === 'disconnected') {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "write",
|
type: 'write',
|
||||||
path: 'webrtcState/isConnected',
|
path: 'webrtcState/isConnected',
|
||||||
data: false,
|
data: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ function getWebsocketEndpointFromUrl(url: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function WebSocketContextFunction({ children }) {
|
export default function WebSocketContextFunction({ children }) {
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
let socket;
|
let socket;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const initialState = {
|
|||||||
output_choice: 'rgb', // the selected output
|
output_choice: 'rgb', // the selected output
|
||||||
minResolution: 50,
|
minResolution: 50,
|
||||||
maxResolution: 512,
|
maxResolution: 512,
|
||||||
field_of_view: 80
|
field_of_view: 80,
|
||||||
},
|
},
|
||||||
// the scene state
|
// the scene state
|
||||||
sceneState: {
|
sceneState: {
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
// allows you to do things like:
|
// allows you to do things like:
|
||||||
// expect(element).toHaveTextContent(/react/i)
|
// expect(element).toHaveTextContent(/react/i)
|
||||||
// learn more: https://github.com/testing-library/jest-dom
|
// learn more: https://github.com/testing-library/jest-dom
|
||||||
import "@testing-library/jest-dom/extend-expect";
|
import '@testing-library/jest-dom/extend-expect';
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export function split_path(path_str) {
|
export function split_path(path_str) {
|
||||||
return path_str.split("/").filter((x) => x.length > 0);
|
return path_str.split('/').filter((x) => x.length > 0);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user