Add better timeline UI positioning for improved viewport navigation
This commit is contained in:
@@ -27,7 +27,8 @@ namespace FlaxEditor.GUI.Timeline.GUI
|
||||
{
|
||||
var style = Style.Current;
|
||||
var icon = Editor.Instance.Icons.VisjectArrowClosed32;
|
||||
var timeAxisHeaderOffset = -_timeline.MediaBackground.ViewOffset.Y;
|
||||
var timeAxisOverlap = Timeline.HeaderTopAreaHeight * 0.5f;
|
||||
var timeAxisHeaderOffset = -_timeline.MediaBackground.ViewOffset.Y - timeAxisOverlap;
|
||||
|
||||
Matrix3x3.RotationZ(Mathf.PiOverTwo, out var m1);
|
||||
var m2 = Matrix3x3.Translation2D(0, timeAxisHeaderOffset);
|
||||
@@ -36,7 +37,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
|
||||
Render2D.DrawSprite(icon, new Rectangle(new Vector2(4, -Width), Size), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground);
|
||||
Render2D.PopTransform();
|
||||
|
||||
Render2D.FillRectangle(new Rectangle(Width * 0.5f, Height + timeAxisHeaderOffset, 1, _timeline.MediaPanel.Height - timeAxisHeaderOffset), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground.RGBMultiplied(0.8f));
|
||||
Render2D.FillRectangle(new Rectangle(Width * 0.5f, Height + timeAxisHeaderOffset, 1, _timeline.MediaPanel.Height - timeAxisHeaderOffset - timeAxisOverlap), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground.RGBMultiplied(0.8f));
|
||||
|
||||
base.Draw();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ namespace FlaxEditor.GUI.Timeline.GUI
|
||||
public override void Draw()
|
||||
{
|
||||
var style = Style.Current;
|
||||
var timeAxisHeaderOffset = -_timeline.MediaBackground.ViewOffset.Y;
|
||||
var timeAxisOverlap = Timeline.HeaderTopAreaHeight * 0.5f;
|
||||
var timeAxisHeaderOffset = -_timeline.MediaBackground.ViewOffset.Y - timeAxisOverlap;
|
||||
|
||||
var moveColor = style.ProgressNormal;
|
||||
var thickness = 2.0f;
|
||||
|
||||
@@ -959,12 +959,12 @@ namespace FlaxEditor.GUI.Timeline
|
||||
private void UpdatePositionHandle()
|
||||
{
|
||||
var handleWidth = 12.0f;
|
||||
_positionHandle.Bounds = new Rectangle(
|
||||
StartOffset * 2.0f - handleWidth * 0.5f + _currentFrame / _framesPerSecond * UnitsPerSecond * Zoom,
|
||||
HeaderTopAreaHeight * -0.5f,
|
||||
handleWidth,
|
||||
HeaderTopAreaHeight * 0.5f
|
||||
);
|
||||
var bounds = new Rectangle();
|
||||
bounds.Location.X = StartOffset * 2.0f - handleWidth * 0.5f + _currentFrame / _framesPerSecond * UnitsPerSecond * Zoom;
|
||||
bounds.Location.Y = 0;
|
||||
bounds.Size.X = handleWidth;
|
||||
bounds.Size.Y = HeaderTopAreaHeight * 0.5f;
|
||||
_positionHandle.Bounds = bounds;
|
||||
}
|
||||
|
||||
private void OnFpsPopupShowing(ComboBox comboBox)
|
||||
@@ -1936,8 +1936,8 @@ namespace FlaxEditor.GUI.Timeline
|
||||
_background.Bounds = new Rectangle(StartOffset, 0, Duration * UnitsPerSecond * Zoom, height);
|
||||
|
||||
var edgeWidth = 6.0f;
|
||||
_leftEdge.Bounds = new Rectangle(_background.Left - edgeWidth * 0.5f + StartOffset, HeaderTopAreaHeight * -0.5f, edgeWidth, height + HeaderTopAreaHeight * 0.5f);
|
||||
_rightEdge.Bounds = new Rectangle(_background.Right - edgeWidth * 0.5f + StartOffset, HeaderTopAreaHeight * -0.5f, edgeWidth, height + HeaderTopAreaHeight * 0.5f);
|
||||
_leftEdge.Bounds = new Rectangle(_background.Left - edgeWidth * 0.5f + StartOffset, 0, edgeWidth, height);
|
||||
_rightEdge.Bounds = new Rectangle(_background.Right - edgeWidth * 0.5f + StartOffset, 0, edgeWidth, height);
|
||||
|
||||
_backgroundScroll.Bounds = new Rectangle(0, 0, _background.Width + 5 * StartOffset, height);
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ namespace FlaxEngine.GUI
|
||||
{
|
||||
_targetValue = value;
|
||||
_value = value;
|
||||
SetUpdate(ref _update, null);
|
||||
OnValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user