From bda57e321ec9d1b83a2545ed4af8ab8b8aeb92a1 Mon Sep 17 00:00:00 2001 From: Donovan Hutchence Date: Wed, 28 Aug 2024 17:23:22 +0200 Subject: [PATCH] UI Tweaks (#179) --- package-lock.json | 4 ++-- package.json | 2 +- src/editor.ts | 15 +++++++++++++-- src/scene-config.ts | 3 ++- src/ui/scene-panel.scss | 6 ++++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 463112a2..5abab99d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supersplat", - "version": "1.2.1", + "version": "1.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "supersplat", - "version": "1.2.1", + "version": "1.2.2", "license": "MIT", "devDependencies": { "@playcanvas/eslint-config": "^1.7.4", diff --git a/package.json b/package.json index dcbbaaa3..21aaf827 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supersplat", - "version": "1.2.1", + "version": "1.2.2", "author": "PlayCanvas", "homepage": "https://playcanvas.com/supersplat/editor", "description": "3D Gaussian Splat Editor", diff --git a/src/editor.ts b/src/editor.ts index a5a97bd0..05d1fce1 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -119,12 +119,19 @@ const registerEditorEvents = (events: Events, editHistory: EditHistory, scene: S // camera.fov + const setCameraFov = (fov: number) => { + if (fov !== scene.camera.fov) { + scene.camera.fov = fov; + events.fire('camera.fov', scene.camera.fov); + } + }; + events.function('camera.fov', () => { return scene.camera.fov; }); events.on('camera.setFov', (fov: number) => { - scene.camera.fov = fov; + setCameraFov(fov); }); // camera.bound @@ -524,7 +531,7 @@ const registerEditorEvents = (events: Events, editHistory: EditHistory, scene: S // camera debug - let cameraDebug = true; + let cameraDebug = scene.config.camera.debug; const setCameraDebug = (enabled: boolean) => { if (enabled !== cameraDebug) { @@ -582,6 +589,10 @@ const registerEditorEvents = (events: Events, editHistory: EditHistory, scene: S events.on('view.setBands', (value: number) => { setViewBands(value); }); + + // hack: fire events to initialize UI + events.fire('camera.fov', scene.camera.fov); + events.fire('camera.debug', cameraDebug); } export { registerEditorEvents }; diff --git a/src/scene-config.ts b/src/scene-config.ts index ed5231b2..b816260c 100644 --- a/src/scene-config.ts +++ b/src/scene-config.ts @@ -24,7 +24,8 @@ const sceneConfig = { fov: 50, exposure: 1.0, toneMapping: 'linear', - debug_render: '' + debug_render: '', + debug: true }, shadow: { intensity: 0.25, diff --git a/src/ui/scene-panel.scss b/src/ui/scene-panel.scss index 75ae0940..6d484942 100644 --- a/src/ui/scene-panel.scss +++ b/src/ui/scene-panel.scss @@ -3,3 +3,9 @@ left: 24px; width: 320px; } + +@media (max-width: 600px) { + #scene-panel { + display: none; + } +}