diff --git a/webclient/src/App.scss b/webclient/src/App.scss
index f90339d..0e5f399 100644
--- a/webclient/src/App.scss
+++ b/webclient/src/App.scss
@@ -1,3 +1,8 @@
+.editor-layout {
+ width: 100vw;
+ height: 100vh;
+}
+
.counter {
font-size: 16px;
padding: 5px 10px;
diff --git a/webclient/src/App.tsx b/webclient/src/App.tsx
index 46bfece..5f9c0ae 100644
--- a/webclient/src/App.tsx
+++ b/webclient/src/App.tsx
@@ -92,11 +92,11 @@ function HomePage() {
function EditorLayout() {
return (
- <>
+
);
}
diff --git a/webclient/src/components/Panels.scss b/webclient/src/components/Panels.scss
index 6770fdb..227441b 100644
--- a/webclient/src/components/Panels.scss
+++ b/webclient/src/components/Panels.scss
@@ -1,5 +1,5 @@
.overlay-panels {
- z-index: 15000;
+ z-index: 9000;
position: fixed;
top: 0;
left: 0;
diff --git a/webclient/src/components/SceneEditorView.tsx b/webclient/src/components/SceneEditorView.tsx
index aee90a1..16443a4 100644
--- a/webclient/src/components/SceneEditorView.tsx
+++ b/webclient/src/components/SceneEditorView.tsx
@@ -5,48 +5,31 @@ import { observer } from 'mobx-react-lite';
import { state } from '../state';
import { SceneView } from './SceneView';
import { MOUSE, type OrthographicCamera, type PerspectiveCamera } from 'three';
-import { CameraSync } from './tools/CameraSync';
+import { useSyncCamera } from '../utils/hooks/useSyncCamera';
import { Physics } from '@react-three/rapier';
export const SceneEditorView = observer(function () {
const controlsRef = useRef>(null);
- const cameraAtStart = useRef('');
-
- function cameraSnapshot(camera: OrthographicCamera | PerspectiveCamera): string {
- return JSON.stringify({
- position: camera.position,
- rotation: camera.rotation,
- });
- }
-
- const handleStart = () => {
- const controls = controlsRef.current;
- if (!controls)
- return;
- cameraAtStart.current = cameraSnapshot(controls.object);
- };
+ useSyncCamera(() => state.view.camera.camera);
const handleEnd = () => {
const controls = controlsRef.current;
if (!controls)
return;
- const snapshot = cameraSnapshot(controls.object);
- if (snapshot === cameraAtStart.current)
- return;
+
const [x, y, z] = controls.object.rotation.toArray();
- state.worldEditor.setCamera({
+ state.view.camera.camera = {
position: controls.object.position.toArray(),
look: [x, y, z],
- });
+ };
};
return (<>
-
{/* {
- // const t = rb.translation();
- // _charPos.set(t.x, t.y, t.z);
- // _offset.copy(shoulderOffset).applyEuler(_e.set(pitchRef.current, yawRef.current, 0, 'YXZ'));
- // camera.position.copy(_charPos).add(_offset);
- // _lookAt.set(t.x, t.y + lookAtY, t.z);
- camera.lookAt(_lookAt);
- });
-
- return null;
-}
diff --git a/webclient/src/components/layers/LayeredThreeView.tsx b/webclient/src/components/layers/LayeredThreeView.tsx
index dab7208..6f215d8 100644
--- a/webclient/src/components/layers/LayeredThreeView.tsx
+++ b/webclient/src/components/layers/LayeredThreeView.tsx
@@ -1,23 +1,19 @@
import { observer } from "mobx-react-lite";
import { ObjectGeometriesLayer } from "./ObjectGeometriesLayer";
import { Canvas } from "@react-three/fiber";
-import { Perf } from "r3f-perf";
-import { state } from "../../state";
-import { CameraLayer } from "./GameraLayer";
+import { SceneEditorCameraLayer } from "./SceneEditorGameraLayer";
+import { LightsLayer } from "./LighsLayer";
+import { StatsLayer } from './StatsLayer';
export const LayeredThreeView = observer(function () {
return <>
-