Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove rounding of slider velocity (when applied as scroll speed) #26616

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class EffectControlPoint : ControlPoint, IEquatable<EffectControlPoint>
/// </summary>
public readonly BindableDouble ScrollSpeedBindable = new BindableDouble(1)
{
Precision = 0.01,
MinValue = 0.01,
MaxValue = 10
};
Expand Down
27 changes: 24 additions & 3 deletions osu.Game/Screens/Edit/Timing/EffectSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,38 @@ void saveChanges()

protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint?> point)
{
if (point.NewValue != null)
scrollSpeedSlider.Current.ValueChanged -= updateControlPointFromSlider;

if (point.NewValue is EffectControlPoint newEffectPoint)
{
isRebinding = true;

kiai.Current = point.NewValue.KiaiModeBindable;
scrollSpeedSlider.Current = point.NewValue.ScrollSpeedBindable;
kiai.Current = newEffectPoint.KiaiModeBindable;
scrollSpeedSlider.Current = new BindableDouble
{
MinValue = 0.01,
MaxValue = 10,
Precision = 0.01,
Value = newEffectPoint.ScrollSpeedBindable.Value
};
scrollSpeedSlider.Current.ValueChanged += updateControlPointFromSlider;
// at this point in time the above is enough to keep the slider control in sync with reality,
// since undo/redo causes `OnControlPointChanged()` to fire.
// whenever that stops being the case, or there is a possibility that the scroll speed could be changed
// by something else other than this control, this code should probably be revisited to have a binding in the other direction, too.

isRebinding = false;
}
}

private void updateControlPointFromSlider(ValueChangedEvent<double> scrollSpeed)
{
if (ControlPoint.Value is not EffectControlPoint effectPoint || isRebinding)
return;

effectPoint.ScrollSpeedBindable.Value = scrollSpeed.NewValue;
}

protected override EffectControlPoint CreatePoint()
{
var reference = Beatmap.ControlPointInfo.EffectPointAt(SelectedGroup.Value.Time);
Expand Down
Loading