Add timeline view panning with right-mouse button even over keyframes editor or curve editor

This commit is contained in:
Wojtek Figat
2021-08-24 12:56:36 +02:00
parent ee3f7aeb53
commit 603c9fac07
8 changed files with 79 additions and 21 deletions

View File

@@ -476,7 +476,10 @@ namespace FlaxEditor.GUI.Timeline.Tracks
{
if (_audioMedia == null || Curve == null || Timeline == null)
return;
Curve.Visible = Visible;
if (!Visible)
return;
Curve.CustomViewPanning = Timeline.OnKeyframesViewPanning;
Curve.Bounds = new Rectangle(_audioMedia.X, Y + 1.0f, _audioMedia.Width, Height - 2.0f);
var expanded = IsExpanded;

View File

@@ -69,7 +69,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
return base.OnMouseDown(location, button);
}
public override void OnMouseMove(Vector2 location)
{
base.OnMouseMove(location);
@@ -84,7 +84,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
}
}
}
public override bool OnMouseUp(Vector2 location, MouseButton button)
{
if (button == MouseButton.Left && _clicked)
@@ -228,6 +228,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
if (!Visible)
return;
var expanded = IsExpanded;
Curve.CustomViewPanning = Timeline.OnKeyframesViewPanning;
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;
@@ -238,7 +239,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Curve.UpdateKeyframes();
if (expanded)
{
if(_splitter == null)
if (_splitter == null)
_splitter = new Splitter
{
_track = this,

View File

@@ -281,9 +281,12 @@ namespace FlaxEditor.GUI.Timeline.Tracks
private void UpdateEvents()
{
if (Events == null)
if (Events == null || Timeline == null)
return;
Events.Visible = Visible;
if (!Visible)
return;
Events.CustomViewPanning = Timeline.OnKeyframesViewPanning;
Events.Bounds = new Rectangle(Timeline.StartOffset, Y + 1.0f, Timeline.Duration * Timeline.UnitsPerSecond * Timeline.Zoom, Height - 2.0f);
Events.ViewScale = new Vector2(Timeline.Zoom, 1.0f);
Events.Visible = Visible;

View File

@@ -248,11 +248,12 @@ namespace FlaxEditor.GUI.Timeline.Tracks
private void UpdateKeyframes()
{
if (Keyframes == null)
if (Keyframes == null || Timeline == null)
return;
Keyframes.Visible = Visible;
if (!Visible)
return;
Keyframes.CustomViewPanning = Timeline.OnKeyframesViewPanning;
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.UpdateKeyframes();