增加双击中键缩放到全部的特性.

This commit is contained in:
ChenX
2018-05-31 10:35:32 +08:00
parent 957107378e
commit 35443367f3
8 changed files with 28 additions and 7 deletions

View File

@@ -141,6 +141,9 @@ export class CameraControls
this.m_State = CameraControlState.Rotate;
this.m_Viewer.UpdateLockTarget();
}
//最后一次按中键的时间
lastMiddleClickTime = 0;
//鼠标
onMouseDown = (event: MouseEvent) =>
{
@@ -161,6 +164,14 @@ export class CameraControls
}
case MouseKey.Middle:
{
let curTime = Date.now();
let t = curTime - this.lastMiddleClickTime;
this.lastMiddleClickTime = curTime;
if (t < 350)
{
this.m_Viewer.ZoomAll();
return;
}
if (this.m_KeyDown.get(KeyBoard.Control))
{
this.beginRotate();