增加用户缩放相机体验,扩大相机范围,并且限定用户的缩放范围,避免缩放后物体过小而对象找不到的问题.
This commit is contained in:
@@ -30,10 +30,13 @@ export class CameraUpdate
|
||||
//观察的轨道.
|
||||
private m_Orbit: Orbit = new Orbit();
|
||||
|
||||
m_MinViewHeight = 10;
|
||||
m_MaxViewHeight = 3e4;
|
||||
|
||||
constructor()
|
||||
{
|
||||
this.m_CameraArray.set(THREE.OrthographicCamera, new THREE.OrthographicCamera(-2, 2, 2, -2,
|
||||
-100000, 100000));
|
||||
-1e6, 1e6));
|
||||
|
||||
this.m_CameraArray.set(THREE.PerspectiveCamera, new THREE.PerspectiveCamera(50, 1, 0.01, 10000));
|
||||
|
||||
@@ -60,7 +63,7 @@ export class CameraUpdate
|
||||
}
|
||||
set ViewHeight(height)
|
||||
{
|
||||
this.m_ViewHeight = THREE.Math.clamp(height, 1e-8, 1e8);
|
||||
this.m_ViewHeight = THREE.Math.clamp(height, this.m_MinViewHeight, this.m_MaxViewHeight);
|
||||
}
|
||||
|
||||
SetSize(width: number, height: number)
|
||||
@@ -114,7 +117,7 @@ export class CameraUpdate
|
||||
if (this.Camera instanceof THREE.OrthographicCamera)
|
||||
{
|
||||
this.ViewHeight *= scale;
|
||||
if (scaleCenter)
|
||||
if (scaleCenter && this.m_ViewHeight < this.m_MaxViewHeight)
|
||||
{
|
||||
this.m_Target.sub(scaleCenter);
|
||||
this.m_Target.multiplyScalar(scale);
|
||||
|
Reference in New Issue
Block a user