Fixes for editor viewport View context menu
This commit is contained in:
@@ -188,7 +188,7 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
if (input.IsPanning)
|
||||
{
|
||||
var panningSpeed = 0.8f;
|
||||
if (_invertPanning)
|
||||
if (Viewport.InvertPanning)
|
||||
{
|
||||
position += up * (mouseDelta.Y * panningSpeed);
|
||||
position += right * (mouseDelta.X * panningSpeed);
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
public abstract class ViewportCamera : IViewportCamera
|
||||
{
|
||||
private EditorViewport _viewport;
|
||||
protected bool _invertPanning;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent viewport.
|
||||
@@ -28,14 +27,6 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
/// </summary>
|
||||
public virtual bool UseMovementSpeed => true;
|
||||
|
||||
/// <summary>
|
||||
/// Sets if the panning direction is inverted.
|
||||
/// </summary>
|
||||
public bool InvertPanning
|
||||
{
|
||||
set => _invertPanning = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets view orientation and position to match the arc ball camera style view for the given target object bounds.
|
||||
/// </summary>
|
||||
|
||||
@@ -465,7 +465,7 @@ namespace FlaxEditor.Viewport
|
||||
var button = camSpeedCM.AddButton(v.ToString());
|
||||
button.Tag = v;
|
||||
}
|
||||
camSpeedCM.ButtonClicked += (button) => MovementSpeed = (float)button.Tag;
|
||||
camSpeedCM.ButtonClicked += button => MovementSpeed = (float)button.Tag;
|
||||
camSpeedCM.VisibleChanged += WidgetCamSpeedShowHide;
|
||||
camSpeedButton.Parent = camSpeed;
|
||||
camSpeed.Parent = this;
|
||||
@@ -526,9 +526,9 @@ namespace FlaxEditor.Viewport
|
||||
// Orthographic
|
||||
{
|
||||
var ortho = ViewWidgetButtonMenu.AddButton("Orthographic");
|
||||
var orthoValue = new CheckBox(80, 2, _isOrtho);
|
||||
var orthoValue = new CheckBox(90, 2, _isOrtho);
|
||||
orthoValue.Parent = ortho;
|
||||
orthoValue.StateChanged += (checkBox) =>
|
||||
orthoValue.StateChanged += checkBox =>
|
||||
{
|
||||
if (checkBox.Checked != _isOrtho)
|
||||
{
|
||||
@@ -554,10 +554,10 @@ namespace FlaxEditor.Viewport
|
||||
// Field of View
|
||||
{
|
||||
var fov = ViewWidgetButtonMenu.AddButton("Field Of View");
|
||||
var fovValue = new FloatValueBox(1, 80, 2, 50.0f, 35.0f, 160.0f, 0.1f);
|
||||
var fovValue = new FloatValueBox(1, 90, 2, 70.0f, 35.0f, 160.0f, 0.1f);
|
||||
fovValue.Parent = fov;
|
||||
fovValue.ValueChanged += () => _fieldOfView = fovValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += (control) =>
|
||||
ViewWidgetButtonMenu.VisibleChanged += control =>
|
||||
{
|
||||
fov.Visible = !_isOrtho;
|
||||
fovValue.Value = _fieldOfView;
|
||||
@@ -567,10 +567,10 @@ namespace FlaxEditor.Viewport
|
||||
// Ortho Scale
|
||||
{
|
||||
var orthoSize = ViewWidgetButtonMenu.AddButton("Ortho Scale");
|
||||
var orthoSizeValue = new FloatValueBox(_orthoSize, 80, 2, 50.0f, 0.001f, 100000.0f, 0.01f);
|
||||
var orthoSizeValue = new FloatValueBox(_orthoSize, 90, 2, 70.0f, 0.001f, 100000.0f, 0.01f);
|
||||
orthoSizeValue.Parent = orthoSize;
|
||||
orthoSizeValue.ValueChanged += () => _orthoSize = orthoSizeValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += (control) =>
|
||||
ViewWidgetButtonMenu.VisibleChanged += control =>
|
||||
{
|
||||
orthoSize.Visible = _isOrtho;
|
||||
orthoSizeValue.Value = _orthoSize;
|
||||
@@ -580,7 +580,7 @@ namespace FlaxEditor.Viewport
|
||||
// Near Plane
|
||||
{
|
||||
var nearPlane = ViewWidgetButtonMenu.AddButton("Near Plane");
|
||||
var nearPlaneValue = new FloatValueBox(2.0f, 80, 2, 50.0f, 0.001f, 1000.0f);
|
||||
var nearPlaneValue = new FloatValueBox(2.0f, 90, 2, 70.0f, 0.001f, 1000.0f);
|
||||
nearPlaneValue.Parent = nearPlane;
|
||||
nearPlaneValue.ValueChanged += () => _nearPlane = nearPlaneValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += control => nearPlaneValue.Value = _nearPlane;
|
||||
@@ -589,7 +589,7 @@ namespace FlaxEditor.Viewport
|
||||
// Far Plane
|
||||
{
|
||||
var farPlane = ViewWidgetButtonMenu.AddButton("Far Plane");
|
||||
var farPlaneValue = new FloatValueBox(1000, 80, 2, 50.0f, 10.0f);
|
||||
var farPlaneValue = new FloatValueBox(1000, 90, 2, 70.0f, 10.0f);
|
||||
farPlaneValue.Parent = farPlane;
|
||||
farPlaneValue.ValueChanged += () => _farPlane = farPlaneValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += control => farPlaneValue.Value = _farPlane;
|
||||
@@ -598,7 +598,7 @@ namespace FlaxEditor.Viewport
|
||||
// Brightness
|
||||
{
|
||||
var brightness = ViewWidgetButtonMenu.AddButton("Brightness");
|
||||
var brightnessValue = new FloatValueBox(1.0f, 80, 2, 50.0f, 0.001f, 10.0f, 0.001f);
|
||||
var brightnessValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.001f, 10.0f, 0.001f);
|
||||
brightnessValue.Parent = brightness;
|
||||
brightnessValue.ValueChanged += () => Brightness = brightnessValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += control => brightnessValue.Value = Brightness;
|
||||
@@ -607,7 +607,7 @@ namespace FlaxEditor.Viewport
|
||||
// Resolution
|
||||
{
|
||||
var resolution = ViewWidgetButtonMenu.AddButton("Resolution");
|
||||
var resolutionValue = new FloatValueBox(1.0f, 80, 2, 50.0f, 0.1f, 4.0f, 0.001f);
|
||||
var resolutionValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.1f, 4.0f, 0.001f);
|
||||
resolutionValue.Parent = resolution;
|
||||
resolutionValue.ValueChanged += () => ResolutionScale = resolutionValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += control => resolutionValue.Value = ResolutionScale;
|
||||
@@ -616,9 +616,9 @@ namespace FlaxEditor.Viewport
|
||||
// Invert Panning
|
||||
{
|
||||
var invert = ViewWidgetButtonMenu.AddButton("Invert Panning");
|
||||
var invertValue = new CheckBox(80, 2, _invertPanning);
|
||||
var invertValue = new CheckBox(90, 2, _invertPanning);
|
||||
invertValue.Parent = invert;
|
||||
invertValue.StateChanged += (checkBox) =>
|
||||
invertValue.StateChanged += checkBox =>
|
||||
{
|
||||
if (checkBox.Checked != _invertPanning)
|
||||
{
|
||||
@@ -900,11 +900,7 @@ namespace FlaxEditor.Viewport
|
||||
protected virtual void UpdateView(float dt, ref Vector3 moveDelta, ref Vector2 mouseDelta, out bool centerMouse)
|
||||
{
|
||||
centerMouse = true;
|
||||
if (_camera != null)
|
||||
{
|
||||
_camera.InvertPanning = _invertPanning;
|
||||
_camera.UpdateView(dt, ref moveDelta, ref mouseDelta, out centerMouse);
|
||||
}
|
||||
_camera?.UpdateView(dt, ref moveDelta, ref mouseDelta, out centerMouse);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
// Preview LOD
|
||||
{
|
||||
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
|
||||
var previewLODValue = new IntValueBox(-1, 75, 2, 50.0f, -1, 10, 0.02f);
|
||||
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f);
|
||||
previewLODValue.Parent = previewLOD;
|
||||
previewLODValue.ValueChanged += () => _previewModel.ForcedLOD = previewLODValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += control => previewLODValue.Value = _previewModel.ForcedLOD;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
// Preview LOD
|
||||
{
|
||||
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
|
||||
var previewLODValue = new IntValueBox(-1, 75, 2, 50.0f, -1, 10, 0.02f);
|
||||
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f);
|
||||
previewLODValue.Parent = previewLOD;
|
||||
previewLODValue.ValueChanged += () => _previewModel.ForcedLOD = previewLODValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += control => previewLODValue.Value = _previewModel.ForcedLOD;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
if (useWidgets)
|
||||
{
|
||||
var playbackDuration = ViewWidgetButtonMenu.AddButton("Duration");
|
||||
var playbackDurationValue = new FloatValueBox(_playbackDuration, 75, 2, 50.0f, 0.1f, 1000000.0f, 0.1f);
|
||||
var playbackDurationValue = new FloatValueBox(_playbackDuration, 90, 2, 70.0f, 0.1f, 1000000.0f, 0.1f);
|
||||
playbackDurationValue.Parent = playbackDuration;
|
||||
playbackDurationValue.ValueChanged += () => PlaybackDuration = playbackDurationValue.Value;
|
||||
ViewWidgetButtonMenu.VisibleChanged += control => playbackDurationValue.Value = PlaybackDuration;
|
||||
|
||||
Reference in New Issue
Block a user