Merge pull request #7644 from peppy/standardise-zoom-levels

Standardise editor timeline zoom across maps of all lengths
This commit is contained in:
Dan Balasescu 2020-01-29 16:04:25 +09:00 committed by GitHub
commit 63501c188a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -30,10 +30,6 @@ public Timeline()
{
ZoomDuration = 200;
ZoomEasing = Easing.OutQuint;
Zoom = 60;
MaxZoom = 240;
ScrollbarVisible = false;
}
@ -64,9 +60,15 @@ private void load(IBindable<WorkingBeatmap> beatmap, IAdjustableClock adjustable
{
waveform.Waveform = b.NewValue.Waveform;
track = b.NewValue.Track;
MinZoom = getZoomLevelForVisibleMilliseconds(10000);
MaxZoom = getZoomLevelForVisibleMilliseconds(500);
Zoom = getZoomLevelForVisibleMilliseconds(2000);
}, true);
}
private float getZoomLevelForVisibleMilliseconds(double milliseconds) => (float)(track.Length / milliseconds);
/// <summary>
/// The timeline's scroll position in the last frame.
/// </summary>

View File

@ -36,12 +36,12 @@ public ZoomableScrollContainer()
base.Content.Add(zoomedContent = new Container { RelativeSizeAxes = Axes.Y });
}
private int minZoom = 1;
private float minZoom = 1;
/// <summary>
/// The minimum zoom level allowed.
/// </summary>
public int MinZoom
public float MinZoom
{
get => minZoom;
set
@ -56,12 +56,12 @@ public int MinZoom
}
}
private int maxZoom = 60;
private float maxZoom = 60;
/// <summary>
/// The maximum zoom level allowed.
/// </summary>
public int MaxZoom
public float MaxZoom
{
get => maxZoom;
set