mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Fix line endings
This commit is contained in:
parent
3f365c6621
commit
bc3d195aa2
@ -1,39 +1,39 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||||
{
|
{
|
||||||
public class Timeline : ZoomableScrollContainer
|
public class Timeline : ZoomableScrollContainer
|
||||||
{
|
{
|
||||||
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
||||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public Timeline()
|
public Timeline()
|
||||||
{
|
{
|
||||||
BeatmapWaveformGraph waveform;
|
BeatmapWaveformGraph waveform;
|
||||||
Child = waveform = new BeatmapWaveformGraph
|
Child = waveform = new BeatmapWaveformGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.FromHex("222"),
|
Colour = OsuColour.FromHex("222"),
|
||||||
Depth = float.MaxValue
|
Depth = float.MaxValue
|
||||||
};
|
};
|
||||||
|
|
||||||
waveform.Beatmap.BindTo(Beatmap);
|
waveform.Beatmap.BindTo(Beatmap);
|
||||||
|
|
||||||
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint);
|
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
// We want time = 0 to be at the centre of the container when scrolled to the start
|
// We want time = 0 to be at the centre of the container when scrolled to the start
|
||||||
Content.Margin = new MarginPadding { Horizontal = DrawWidth / 2 };
|
Content.Margin = new MarginPadding { Horizontal = DrawWidth / 2 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,132 +1,132 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||||
{
|
{
|
||||||
public class TimelineArea : CompositeDrawable
|
public class TimelineArea : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private readonly Timeline timeline;
|
private readonly Timeline timeline;
|
||||||
|
|
||||||
public TimelineArea()
|
public TimelineArea()
|
||||||
{
|
{
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
|
|
||||||
OsuCheckbox hitObjectsCheckbox;
|
OsuCheckbox hitObjectsCheckbox;
|
||||||
OsuCheckbox hitSoundsCheckbox;
|
OsuCheckbox hitSoundsCheckbox;
|
||||||
OsuCheckbox waveformCheckbox;
|
OsuCheckbox waveformCheckbox;
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.FromHex("111")
|
Colour = OsuColour.FromHex("111")
|
||||||
},
|
},
|
||||||
new GridContainer
|
new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.FromHex("222")
|
Colour = OsuColour.FromHex("222")
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Width = 160,
|
Width = 160,
|
||||||
Padding = new MarginPadding { Horizontal = 15 },
|
Padding = new MarginPadding { Horizontal = 15 },
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(0, 4),
|
Spacing = new Vector2(0, 4),
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
hitObjectsCheckbox = new OsuCheckbox { LabelText = "Hitobjects" },
|
hitObjectsCheckbox = new OsuCheckbox { LabelText = "Hitobjects" },
|
||||||
hitSoundsCheckbox = new OsuCheckbox { LabelText = "Hitsounds" },
|
hitSoundsCheckbox = new OsuCheckbox { LabelText = "Hitsounds" },
|
||||||
waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" }
|
waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.FromHex("333")
|
Colour = OsuColour.FromHex("333")
|
||||||
},
|
},
|
||||||
new Container<TimelineButton>
|
new Container<TimelineButton>
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new TimelineButton
|
new TimelineButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Height = 0.5f,
|
Height = 0.5f,
|
||||||
Icon = FontAwesome.fa_search_plus,
|
Icon = FontAwesome.fa_search_plus,
|
||||||
Action = () => timeline.Zoom++
|
Action = () => timeline.Zoom++
|
||||||
},
|
},
|
||||||
new TimelineButton
|
new TimelineButton
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Height = 0.5f,
|
Height = 0.5f,
|
||||||
Icon = FontAwesome.fa_search_minus,
|
Icon = FontAwesome.fa_search_minus,
|
||||||
Action = () => timeline.Zoom--
|
Action = () => timeline.Zoom--
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
timeline = new Timeline { RelativeSizeAxes = Axes.Both }
|
timeline = new Timeline { RelativeSizeAxes = Axes.Both }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ColumnDimensions = new[]
|
ColumnDimensions = new[]
|
||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
new Dimension(GridSizeMode.Distributed),
|
new Dimension(GridSizeMode.Distributed),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hitObjectsCheckbox.Current.Value = true;
|
hitObjectsCheckbox.Current.Value = true;
|
||||||
hitSoundsCheckbox.Current.Value = true;
|
hitSoundsCheckbox.Current.Value = true;
|
||||||
waveformCheckbox.Current.Value = true;
|
waveformCheckbox.Current.Value = true;
|
||||||
|
|
||||||
timeline.Beatmap.BindTo(Beatmap);
|
timeline.Beatmap.BindTo(Beatmap);
|
||||||
timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,116 +1,116 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||||
{
|
{
|
||||||
public class ZoomableScrollContainer : ScrollContainer
|
public class ZoomableScrollContainer : ScrollContainer
|
||||||
{
|
{
|
||||||
private readonly Container zoomedContent;
|
private readonly Container zoomedContent;
|
||||||
protected override Container<Drawable> Content => zoomedContent;
|
protected override Container<Drawable> Content => zoomedContent;
|
||||||
|
|
||||||
private float currentZoom = 10;
|
private float currentZoom = 10;
|
||||||
|
|
||||||
public ZoomableScrollContainer()
|
public ZoomableScrollContainer()
|
||||||
: base(Direction.Horizontal)
|
: base(Direction.Horizontal)
|
||||||
{
|
{
|
||||||
base.Content.Add(zoomedContent = new Container { RelativeSizeAxes = Axes.Y });
|
base.Content.Add(zoomedContent = new Container { RelativeSizeAxes = Axes.Y });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the content zoom of this <see cref="Timeline"/>.
|
/// Gets or sets the content zoom of this <see cref="Timeline"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Zoom
|
public int Zoom
|
||||||
{
|
{
|
||||||
get => zoomTarget;
|
get => zoomTarget;
|
||||||
set => setZoomTarget(value, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X);
|
set => setZoomTarget(value, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
zoomedContent.Width = DrawWidth * currentZoom;
|
zoomedContent.Width = DrawWidth * currentZoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnWheel(InputState state)
|
protected override bool OnWheel(InputState state)
|
||||||
{
|
{
|
||||||
if (!state.Keyboard.ControlPressed)
|
if (!state.Keyboard.ControlPressed)
|
||||||
return base.OnWheel(state);
|
return base.OnWheel(state);
|
||||||
|
|
||||||
setZoomTarget(zoomTarget + state.Mouse.WheelDelta, zoomedContent.ToLocalSpace(state.Mouse.NativeState.Position).X);
|
setZoomTarget(zoomTarget + state.Mouse.WheelDelta, zoomedContent.ToLocalSpace(state.Mouse.NativeState.Position).X);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int zoomTarget = 10;
|
private int zoomTarget = 10;
|
||||||
private void setZoomTarget(int newZoom, float focusPoint)
|
private void setZoomTarget(int newZoom, float focusPoint)
|
||||||
{
|
{
|
||||||
zoomTarget = MathHelper.Clamp(newZoom, 1, 60);
|
zoomTarget = MathHelper.Clamp(newZoom, 1, 60);
|
||||||
transformZoomTo(zoomTarget, focusPoint, 200, Easing.OutQuint);
|
transformZoomTo(zoomTarget, focusPoint, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transformZoomTo(int newZoom, float focusPoint, double duration = 0, Easing easing = Easing.None)
|
private void transformZoomTo(int newZoom, float focusPoint, double duration = 0, Easing easing = Easing.None)
|
||||||
=> this.TransformTo(this.PopulateTransform(new TransformZoom(focusPoint, zoomedContent.DrawWidth, Current), newZoom, duration, easing));
|
=> this.TransformTo(this.PopulateTransform(new TransformZoom(focusPoint, zoomedContent.DrawWidth, Current), newZoom, duration, easing));
|
||||||
|
|
||||||
private class TransformZoom : Transform<float, ZoomableScrollContainer>
|
private class TransformZoom : Transform<float, ZoomableScrollContainer>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The focus point in absolute coordinates local to the content.
|
/// The focus point in absolute coordinates local to the content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly float focusPoint;
|
private readonly float focusPoint;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The size of the content.
|
/// The size of the content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly float contentSize;
|
private readonly float contentSize;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The scroll offset at the start of the transform.
|
/// The scroll offset at the start of the transform.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly float scrollOffset;
|
private readonly float scrollOffset;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transforms <see cref="TimeTimelinem"/> to a new value.
|
/// Transforms <see cref="TimeTimelinem"/> to a new value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="focusPoint">The focus point in absolute coordinates local to the content.</param>
|
/// <param name="focusPoint">The focus point in absolute coordinates local to the content.</param>
|
||||||
/// <param name="contentSize">The size of the content.</param>
|
/// <param name="contentSize">The size of the content.</param>
|
||||||
/// <param name="scrollOffset">The scroll offset at the start of the transform.</param>
|
/// <param name="scrollOffset">The scroll offset at the start of the transform.</param>
|
||||||
public TransformZoom(float focusPoint, float contentSize, float scrollOffset)
|
public TransformZoom(float focusPoint, float contentSize, float scrollOffset)
|
||||||
{
|
{
|
||||||
this.focusPoint = focusPoint;
|
this.focusPoint = focusPoint;
|
||||||
this.contentSize = contentSize;
|
this.contentSize = contentSize;
|
||||||
this.scrollOffset = scrollOffset;
|
this.scrollOffset = scrollOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TargetMember => nameof(currentZoom);
|
public override string TargetMember => nameof(currentZoom);
|
||||||
|
|
||||||
private float valueAt(double time)
|
private float valueAt(double time)
|
||||||
{
|
{
|
||||||
if (time < StartTime) return StartValue;
|
if (time < StartTime) return StartValue;
|
||||||
if (time >= EndTime) return EndValue;
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Apply(ZoomableScrollContainer d, double time)
|
protected override void Apply(ZoomableScrollContainer d, double time)
|
||||||
{
|
{
|
||||||
float newZoom = valueAt(time);
|
float newZoom = valueAt(time);
|
||||||
|
|
||||||
float focusOffset = focusPoint - scrollOffset;
|
float focusOffset = focusPoint - scrollOffset;
|
||||||
float expectedWidth = d.DrawWidth * newZoom;
|
float expectedWidth = d.DrawWidth * newZoom;
|
||||||
float targetOffset = expectedWidth * (focusPoint / contentSize) - focusOffset;
|
float targetOffset = expectedWidth * (focusPoint / contentSize) - focusOffset;
|
||||||
|
|
||||||
d.currentZoom = newZoom;
|
d.currentZoom = newZoom;
|
||||||
d.ScrollTo(targetOffset, false);
|
d.ScrollTo(targetOffset, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ReadIntoStartValue(ZoomableScrollContainer d) => StartValue = d.currentZoom;
|
protected override void ReadIntoStartValue(ZoomableScrollContainer d) => StartValue = d.currentZoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user