Skip to content

Commit 594ad70

Browse files
committed
Fix some of the value convert from float to double.
see: ppy/osu#31474
1 parent a391384 commit 594ad70

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

osu.Game.Rulesets.Karaoke/Edit/KaraokeHitObjectComposer.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.Generic;
66
using System.Linq;
77
using osu.Framework.Allocation;
8+
using osu.Framework.Graphics;
89
using osu.Framework.Graphics.UserInterface;
910
using osu.Framework.Testing;
1011
using osu.Game.Beatmaps;
@@ -179,5 +180,5 @@ protected void CreateMenuBar()
179180

180181
protected override IReadOnlyList<CompositionTool> CompositionTools => Array.Empty<CompositionTool>();
181182

182-
protected override IEnumerable<TernaryButton> CreateTernaryButtons() => Array.Empty<TernaryButton>();
183+
protected override IEnumerable<Drawable> CreateTernaryButtons() => Array.Empty<Drawable>();
183184
}

osu.Game.Rulesets.Karaoke/Extensions/ScrollContainerExtensions.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public static class ScrollContainerExtensions
2121
public static void ScrollIntoViewWithSpacing<T>(this ScrollContainer<T> container, Drawable d, MarginPadding p, bool animated = true)
2222
where T : Drawable
2323
{
24-
float childPos0 = Math.Clamp(container.GetChildPosInContent(d, -new Vector2(p.Left, p.Top)), 0, container.AvailableContent);
25-
float childPos1 = Math.Clamp(container.GetChildPosInContent(d, d.DrawSize + new Vector2(p.Right, p.Bottom)), 0, container.AvailableContent);
24+
double childPos0 = Math.Clamp(container.GetChildPosInContent(d, -new Vector2(p.Left, p.Top)), 0, container.AvailableContent);
25+
double childPos1 = Math.Clamp(container.GetChildPosInContent(d, d.DrawSize + new Vector2(p.Right, p.Bottom)), 0, container.AvailableContent);
2626

2727
int scrollDim = container.ScrollDirection == Direction.Horizontal ? 0 : 1;
28-
float minPos = Math.Min(childPos0, childPos1);
29-
float maxPos = Math.Max(childPos0, childPos1);
28+
double minPos = Math.Min(childPos0, childPos1);
29+
double maxPos = Math.Max(childPos0, childPos1);
3030

3131
if (minPos < container.Current || (minPos > container.Current && d.DrawSize[scrollDim] > container.DisplayableContent))
3232
container.ScrollTo(minPos, animated);

osu.Game.Rulesets.Karaoke/Overlays/KaraokeChangelogOverlay.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected override void UpdateAfterChildren()
108108
{
109109
base.UpdateAfterChildren();
110110
sidebarContainer.Height = DrawHeight;
111-
sidebarContainer.Y = Math.Clamp(ScrollFlow.Current - Header.DrawHeight, 0, Math.Max(ScrollFlow.ScrollContent.DrawHeight - DrawHeight - Header.DrawHeight, 0));
111+
sidebarContainer.Y = (float)Math.Clamp(ScrollFlow.Current - Header.DrawHeight, 0, Math.Max(ScrollFlow.ScrollContent.DrawHeight - DrawHeight - Header.DrawHeight, 0));
112112
}
113113

114114
protected override ChangelogHeader CreateHeader() => new()

osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/RecordingTimeTags/RecordingTimeTagScrollContainer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public partial class RecordingTimeTagScrollContainer : TimeTagScrollContainer
2929
/// <summary>
3030
/// The timeline's scroll position in the last frame.
3131
/// </summary>
32-
private float lastScrollPosition;
32+
private double lastScrollPosition;
3333

3434
/// <summary>
3535
/// The track time in the last frame.

osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/TimeTagScrollContainer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public double GetPreviewTime(TimeTag timeTag)
163163
return index * preempt_time;
164164
}
165165

166-
public double TimeAtPosition(float x)
166+
public double TimeAtPosition(double x)
167167
{
168168
return x / Content.DrawWidth * editorClock.TrackLength;
169169
}

osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Containers/BindableScrollContainer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ float getCurrentPosition()
8282
*/
8383
}
8484

85-
protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = null)
85+
protected override void OnUserScroll(double value, bool animated = true, double? distanceDecay = null)
8686
{
8787
base.OnUserScroll(value, animated, distanceDecay);
8888

8989
// update current value if user scroll to.
90-
BindableCurrent.Value = value;
90+
BindableCurrent.Value = (float)value;
9191
}
9292
}

osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsPanel.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ void initialBackground()
149149
if (x.NewValue == null)
150150
return;
151151

152-
const int offset = 8;
153-
float position = scrollContainer.GetChildPosInContent(x.NewValue);
152+
const float offset = 8;
153+
float position = (float)scrollContainer.GetChildPosInContent(x.NewValue);
154154
hoverBackground.MoveToY(position + offset, 50);
155155
hoverBackground.ResizeHeightTo(x.NewValue.DrawHeight, 100);
156156
});

0 commit comments

Comments
 (0)