Add F to focus camera view in asset previews
This commit is contained in:
@@ -94,6 +94,15 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
Viewport.ViewPosition = _orbitCenter + localPosition;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SetArcBallView(Quaternion orientation, Vector3 orbitCenter, float orbitRadius)
|
||||
{
|
||||
base.SetArcBallView(orientation, orbitCenter, orbitRadius);
|
||||
|
||||
_orbitCenter = orbitCenter;
|
||||
_orbitRadius = orbitRadius;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void UpdateView(float dt, ref Vector3 moveDelta, ref Vector2 mouseDelta, out bool centerMouse)
|
||||
{
|
||||
|
||||
@@ -166,6 +166,14 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
MoveViewport(position, orientation);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SetArcBallView(Quaternion orientation, Vector3 orbitCenter, float orbitRadius)
|
||||
{
|
||||
base.SetArcBallView(orientation, orbitCenter, orbitRadius);
|
||||
|
||||
TargetPoint = orbitCenter;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
/// <param name="orientation">The view rotation.</param>
|
||||
/// <param name="orbitCenter">The orbit center location.</param>
|
||||
/// <param name="orbitRadius">The orbit radius.</param>
|
||||
public void SetArcBallView(Quaternion orientation, Vector3 orbitCenter, float orbitRadius)
|
||||
public virtual void SetArcBallView(Quaternion orientation, Vector3 orbitCenter, float orbitRadius)
|
||||
{
|
||||
// Rotate
|
||||
Viewport.ViewOrientation = orientation;
|
||||
|
||||
@@ -249,6 +249,19 @@ namespace FlaxEditor.Viewport.Previews
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnKeyDown(KeyboardKeys key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyboardKeys.F:
|
||||
// Pay respect..
|
||||
ViewportCamera.SetArcBallView(_previewModel.Box);
|
||||
break;
|
||||
}
|
||||
return base.OnKeyDown(key);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDestroy()
|
||||
{
|
||||
|
||||
@@ -85,6 +85,19 @@ namespace FlaxEditor.Viewport.Previews
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnKeyDown(KeyboardKeys key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyboardKeys.F:
|
||||
// Pay respect..
|
||||
ViewportCamera.SetArcBallView(_previewModel.Box);
|
||||
break;
|
||||
}
|
||||
return base.OnKeyDown(key);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDestroy()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user