mirror of
https://github.com/transformerlab/transformerlab-app.git
synced 2025-04-14 07:48:20 +03:00
Adjust camera position to fit the entire grid in the Model Layer Visualization
This commit is contained in:
@@ -563,6 +563,13 @@ export default function ModelLayerVisualization({
|
||||
// Point the camera at the center of the grid
|
||||
camera.lookAt(0, 0, 0);
|
||||
|
||||
// zoom out the camera to fit the entire grid:
|
||||
const maxDimension = Math.max(width, length);
|
||||
const cameraDistance = maxDimension * (boxSize + spacing) * 0.75;
|
||||
camera.position.set(0, cameraDistance, cameraDistance);
|
||||
camera.lookAt(0, 0, 0);
|
||||
controls.target.set(0, 0, 0);
|
||||
|
||||
controls.update();
|
||||
|
||||
// Add lights
|
||||
|
||||
Reference in New Issue
Block a user