Closed ershuaili closed 7 months ago
I set "ignorePaperSpace: true," but it doesn't work.
The idea is to get object's bounding box then zoom to it. Can you try this?
I have set it viewer.zoomToBBox(bBox); It does zoom in, but it doesn't scale to completely fill the window there is still distance.
Well, it designed to have a margin around. Can you tell me why do you want it to completely fill the window?
You can implement the zoomToBBox() by yourself:
public zoomToBBox(bbox: THREE.Box3): void {
const center = bbox.getCenter(tempVec3);
const sizeX = bbox.max.x - bbox.min.x;
const sizeY = bbox.max.y - bbox.min.y;
const leftRightSize = this.camera.right - this.camera.left;
const bottomTopSize = this.camera.top - this.camera.bottom;
let targetCameraZoom = Math.min(leftRightSize / sizeX, bottomTopSize / sizeY);
this.cameraManager.cameraControls.moveTo(center.x, center.y, center.z);
this.cameraManager.cameraControls.zoomTo(targetCameraZoom);
}
I want the model to specify its size when it is initially loaded, or have it completely fill the view. How do I set this up?