From db672becbc19558b70645de20c9f59947ead1fa2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 12 Oct 2017 17:50:51 +0900 Subject: [PATCH] Implement waveform checkbox --- .../Edit/Screens/Compose/Timeline/ScrollableTimeline.cs | 6 +++++- .../Screens/Compose/Timeline/ScrollingTimelineContainer.cs | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollableTimeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollableTimeline.cs index 14c4f2d369..bf1237f1f7 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollableTimeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollableTimeline.cs @@ -23,6 +23,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline Masking = true; CornerRadius = 5; + OsuCheckbox waveformCheckbox; InternalChildren = new Drawable[] { new Box @@ -60,7 +61,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline { new OsuCheckbox { LabelText = "Hitobjects" }, new OsuCheckbox { LabelText = "Hitsounds" }, - new OsuCheckbox { LabelText = "Waveform" } + waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" } } } } @@ -106,7 +107,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline } }; + waveformCheckbox.Current.Value = true; + timelineContainer.Beatmap.BindTo(Beatmap); + timelineContainer.WaveformVisible.BindTo(waveformCheckbox.Current); } protected override void Update() diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollingTimelineContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollingTimelineContainer.cs index 00b7e52e27..a15db3d0df 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollingTimelineContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ScrollingTimelineContainer.cs @@ -14,6 +14,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline { internal class ScrollingTimelineContainer : ScrollContainer { + public readonly Bindable WaveformVisible = new Bindable(); public readonly Bindable Beatmap = new Bindable(); private readonly BeatmapWaveformGraph waveform; @@ -34,6 +35,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline Content.RelativeSizeAxes = Axes.Both; waveform.Beatmap.BindTo(Beatmap); + WaveformVisible.ValueChanged += waveformVisibilityChanged; } private float minZoom = 1; @@ -129,5 +131,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline return true; } + + private void waveformVisibilityChanged(bool visible) => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint); } }