Skip to content

Commit e8c8c90

Browse files
authored
update default camera position (#760)
* set camera to `5, 5, 5` * update camera default position
1 parent 7c629e9 commit e8c8c90

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

app/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default function App() {
8787
const [roomName, setRoomName] = useState<string>("");
8888
const [geometries, setGeometries] = useState<any>([]);
8989
const [cameraAndControls, setCameraAndControls] = useState<any>({
90-
camera: new THREE.Vector3(0, 0, 0),
90+
camera: new THREE.Vector3(5, 5, 5),
9191
target: new THREE.Vector3(0, 0, 0),
9292
});
9393
// TODO: initial values are wrong for orbitcontrolstarget and camperaPosition

app/src/components/cameraAndControls.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import * as THREE from "three";
1818
import { getCentroid, useCentroid } from "./particlesEditor";
1919

2020
const zeroVector = new THREE.Vector3(0, 0, 0);
21+
const initialCameraVector = new THREE.Vector3(5, 5, 5);
2122
const upVector = new THREE.Vector3(0, 1, 0);
2223

2324
const MoveCameraTarget = forwardRef(
@@ -164,7 +165,7 @@ const CameraAndControls: React.FC<CameraAndControlsProps> = ({
164165
// if the camera positions and target positions is default, adapt them to the scene
165166
useEffect(() => {
166167
if (
167-
cameraAndControls.camera.equals(zeroVector) &&
168+
cameraAndControls.camera.equals(initialCameraVector) &&
168169
cameraAndControls.target.equals(zeroVector)
169170
) {
170171
const resetCamera = getResetCamera();

tests/test_camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def test_camera(server, s22):
66
vis = ZnDraw(url=server, token="test_token")
77
vis.extend(s22)
88

9-
assert vis.camera["position"] == [0, 0, 0]
9+
assert vis.camera["position"] == [5, 5, 5]
1010
assert vis.camera["target"] == [0, 0, 0]
1111
assert len(vis.camera) == 2
1212

zndraw/zndraw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def camera(self) -> CameraData:
549549
socket=self._refresh_client,
550550
)
551551
if "position" not in camera_dct:
552-
camera_dct["position"] = [0, 0, 0]
552+
camera_dct["position"] = [5, 5, 5]
553553
if "target" not in camera_dct:
554554
camera_dct["target"] = [0, 0, 0]
555555
return camera_dct

0 commit comments

Comments
 (0)