Adjust curve background drawing for timeline

This commit is contained in:
Wojtek Figat
2021-08-24 12:15:38 +02:00
parent 4172ca39dc
commit ee3f7aeb53
4 changed files with 9 additions and 7 deletions

View File

@@ -87,7 +87,7 @@ namespace FlaxEditor.GUI
/// <summary>
/// Enables drawing time and values axes (lines and labels).
/// </summary>
public bool ShowAxes = true;
public UseMode ShowAxes = UseMode.On;
/// <summary>
/// Gets the type of the curves keyframes value.

View File

@@ -793,7 +793,7 @@ namespace FlaxEditor.GUI
}
// Draw time and values axes
if (ShowAxes)
if (ShowAxes != UseMode.Off)
{
var upperLeft = PointToKeyframes(viewRect.Location, ref viewRect);
var bottomRight = PointToKeyframes(viewRect.Size, ref viewRect);
@@ -804,8 +804,10 @@ namespace FlaxEditor.GUI
Render2D.PushClip(ref viewRect);
DrawAxis(Vector2.UnitX, ref viewRect, min.X, max.X, pixelRange.X);
DrawAxis(Vector2.UnitY, ref viewRect, min.Y, max.Y, pixelRange.Y);
if ((ShowAxes & UseMode.Vertical) == UseMode.Vertical)
DrawAxis(Vector2.UnitX, ref viewRect, min.X, max.X, pixelRange.X);
if ((ShowAxes & UseMode.Horizontal) == UseMode.Horizontal)
DrawAxis(Vector2.UnitY, ref viewRect, min.Y, max.Y, pixelRange.Y);
Render2D.PopClip();
}

View File

@@ -493,7 +493,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
}
Curve.ShowCollapsed = !expanded;
Curve.ShowBackground = expanded;
Curve.ShowAxes = expanded;
Curve.ShowAxes = expanded ? CurveEditorBase.UseMode.Horizontal : CurveEditorBase.UseMode.Off;
Curve.Visible = Visible;
Curve.UpdateKeyframes();
}

View File

@@ -231,8 +231,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Curve.Bounds = new Rectangle(Timeline.StartOffset, Y + 1.0f, Timeline.Duration * Timeline.UnitsPerSecond * Timeline.Zoom, Height - 2.0f);
Curve.ViewScale = new Vector2(Timeline.Zoom, Curve.ViewScale.Y);
Curve.ShowCollapsed = !expanded;
Curve.ShowBackground = expanded;
Curve.ShowAxes = expanded;
Curve.ShowAxes = expanded ? CurveEditorBase.UseMode.Horizontal : CurveEditorBase.UseMode.Off;
Curve.EnableZoom = expanded ? CurveEditorBase.UseMode.Vertical : CurveEditorBase.UseMode.Off;
Curve.EnablePanning = expanded ? CurveEditorBase.UseMode.Vertical : CurveEditorBase.UseMode.Off;
Curve.ScrollBars = expanded ? ScrollBars.Vertical : ScrollBars.None;
@@ -293,6 +292,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Curve = (CurveEditorBase)Activator.CreateInstance(curveEditorType);
Curve.EnableZoom = CurveEditorBase.UseMode.Vertical;
Curve.EnablePanning = CurveEditorBase.UseMode.Vertical;
Curve.ShowBackground = false;
Curve.ScrollBars = ScrollBars.Vertical;
Curve.Parent = Timeline?.MediaPanel;
Curve.FPS = Timeline?.FramesPerSecond;