mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 02:02:08 +00:00
[3d] some general improvement (#2714)
This commit is contained in:
@@ -29,7 +29,7 @@ export class CameraManager implements CameraManagerInterface {
|
||||
}
|
||||
|
||||
DEFAULT_PERSPECTIVE_CAMERA = {
|
||||
fov: 75,
|
||||
fov: 35,
|
||||
aspect: 1
|
||||
}
|
||||
|
||||
@@ -99,6 +99,11 @@ export class CameraManager implements CameraManagerInterface {
|
||||
const rotation = oldCamera.rotation.clone()
|
||||
const target = this.controls?.target.clone() || new THREE.Vector3()
|
||||
|
||||
const oldZoom =
|
||||
oldCamera instanceof THREE.OrthographicCamera
|
||||
? oldCamera.zoom
|
||||
: (oldCamera as THREE.PerspectiveCamera).zoom
|
||||
|
||||
if (!cameraType) {
|
||||
this.activeCamera =
|
||||
oldCamera === this.perspectiveCamera
|
||||
@@ -118,6 +123,14 @@ export class CameraManager implements CameraManagerInterface {
|
||||
this.activeCamera.position.copy(position)
|
||||
this.activeCamera.rotation.copy(rotation)
|
||||
|
||||
if (this.activeCamera instanceof THREE.OrthographicCamera) {
|
||||
this.activeCamera.zoom = oldZoom
|
||||
this.activeCamera.updateProjectionMatrix()
|
||||
} else if (this.activeCamera instanceof THREE.PerspectiveCamera) {
|
||||
this.activeCamera.zoom = oldZoom
|
||||
this.activeCamera.updateProjectionMatrix()
|
||||
}
|
||||
|
||||
if (this.controls) {
|
||||
this.controls.object = this.activeCamera
|
||||
this.controls.target.copy(target)
|
||||
|
||||
Reference in New Issue
Block a user