Optimize UI for complex timelines with many tracks

This commit is contained in:
Wojtek Figat
2021-07-29 10:25:58 +02:00
parent 3331753bcd
commit d505160444
6 changed files with 12 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
/// The timeline background control.
/// </summary>
/// <seealso cref="FlaxEngine.GUI.ContainerControl" />
public class Background : ContainerControl
class Background : ContainerControl
{
private readonly Timeline _timeline;
private float[] _tickSteps;

View File

@@ -9,7 +9,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
/// The timeline current position tracking control.
/// </summary>
/// <seealso cref="FlaxEngine.GUI.ContainerControl" />
public class PositionHandle : ContainerControl
class PositionHandle : ContainerControl
{
private Timeline _timeline;

View File

@@ -10,7 +10,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
/// Timeline ending edge control that can be used to modify timeline duration with a mouse.
/// </summary>
/// <seealso cref="FlaxEngine.GUI.ContainerControl" />
public class TimelineEdge : Control
class TimelineEdge : Control
{
private Timeline _timeline;
private bool _isMoving;

View File

@@ -532,7 +532,7 @@ namespace FlaxEditor.GUI.Timeline
/// <summary>
/// Gets the media controls parent panel.
/// </summary>
public Background MediaPanel => _background;
public ContainerControl MediaPanel => _background;
/// <summary>
/// Gets the track controls parent panel.

View File

@@ -142,7 +142,9 @@ namespace FlaxEditor.GUI.Timeline.Tracks
{
if (Curve == null || Timeline == null)
return;
Curve.Visible = Visible;
if (!Visible)
return;
var expanded = IsExpanded;
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);
@@ -152,7 +154,6 @@ namespace FlaxEditor.GUI.Timeline.Tracks
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;
Curve.Visible = Visible;
Curve.UpdateKeyframes();
}
@@ -250,10 +251,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
{
base.OnVisibleChanged();
if (Curve != null)
{
Curve.Visible = Visible;
}
UpdateCurve();
}
/// <inheritdoc />

View File

@@ -250,10 +250,11 @@ namespace FlaxEditor.GUI.Timeline.Tracks
{
if (Keyframes == null)
return;
Keyframes.Visible = Visible;
if (!Visible)
return;
Keyframes.Bounds = new Rectangle(Timeline.StartOffset, Y + 1.0f, Timeline.Duration * Timeline.UnitsPerSecond * Timeline.Zoom, Height - 2.0f);
Keyframes.ViewScale = new Vector2(Timeline.Zoom, 1.0f);
Keyframes.Visible = Visible;
Keyframes.UpdateKeyframes();
}
@@ -318,7 +319,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
{
base.OnVisibleChanged();
Keyframes.Visible = Visible;
UpdateKeyframes();
}
/// <inheritdoc />