优化:在切换视图时,锁定查看选中物体

pull/1545/head
ChenX 3 years ago
parent 0cfc8186b9
commit 503f6d896e

@ -41,7 +41,6 @@ export class ViewChange implements Command
}
});
if (vres.Status === PromptStatus.OK)
{
let vs = vres.SelectSet.SelectEntityList as ViewportEntity[];
@ -53,20 +52,19 @@ export class ViewChange implements Command
app.Viewer.CameraCtrl.LookAt(this.viewDir);
this.UcsLookAt(this.viewDir);
app.Viewer.ZoomAll();
app.Editor.UpdateScreen();
if (app.Editor.SelectCtrl.SelectSet.SelectObjectCount)
app.Viewer.ZoomtoEntitys(app.Editor.SelectCtrl.SelectSet.SelectEntityList);
else
app.Viewer.ZoomAll();
}
UcsLookAt(viewDir: Vector3)
{
if (this.useWCS)
{
app.Editor.UCSMatrix = new Matrix4();
}
else
{
app.Editor.SetUCSLookAt(viewDir);
}
}
private ChangeViewport(vs: ViewportEntity[])
{

@ -7,6 +7,9 @@ const ViewScopeSize = 4e6;
const ViewScopeMin = new Vector3(-ViewScopeSize, -ViewScopeSize * 0.7, -ViewScopeSize);
const ViewScopeMax = ViewScopeMin.clone().negate();
const ViewBoxMin = new Vector3(1, 1, 1);
const viewBoxMax = new Vector3(1e7, 1e7, 1e7);
export enum CameraType
{
OrthographicCamera = 1,
@ -165,8 +168,9 @@ export class CameraUpdate
box3.getCenter(this._Target);
//世界坐标系
this._Target.applyMatrix4(this.Camera.matrix);
//size
let size = box3.getSize(new Vector3());
size.clamp(ViewBoxMin, viewBoxMax);
//宽高比
let aspectRatio = size.x / size.y;

Loading…
Cancel
Save