1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:47:29 +08:00

Merge pull request #26499 from OliBomby/slider-performance

Fix lag when dragging first slider control point in editor
This commit is contained in:
Dean Herbert 2024-01-16 13:22:49 +09:00 committed by GitHub
commit 2fdbc501c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 9 deletions

View File

@ -51,10 +51,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
base.LoadComplete();
hitObjectPosition = hitObject.PositionBindable.GetBoundCopy();
hitObjectPosition.BindValueChanged(_ => updateConnectingPath());
hitObjectPosition.BindValueChanged(_ => Scheduler.AddOnce(updateConnectingPath));
pathVersion = hitObject.Path.Version.GetBoundCopy();
pathVersion.BindValueChanged(_ => updateConnectingPath());
pathVersion.BindValueChanged(_ => Scheduler.AddOnce(updateConnectingPath));
updateConnectingPath();
}

View File

@ -244,6 +244,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
else if (slidingSample.IsPlaying)
slidingSample.Stop();
}
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
// During slider path editing, the PlaySliderBody is scheduled to refresh once on Update.
// It is crucial to perform the code below in UpdateAfterChildren. This ensures that the SliderBody has the opportunity
// to update its Size and PathOffset beforehand, ensuring correct placement.
double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1);

View File

@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects
set
{
repeatCount = value;
updateNestedPositions();
endPositionCache.Invalidate();
}
}
@ -165,7 +165,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public Slider()
{
SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples();
Path.Version.ValueChanged += _ => updateNestedPositions();
Path.Version.ValueChanged += _ => endPositionCache.Invalidate();
}
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)

View File

@ -14,16 +14,16 @@ namespace osu.Game.Rulesets.Osu.Objects
/// </summary>
public abstract class SliderEndCircle : HitCircle
{
private readonly Slider slider;
protected readonly Slider Slider;
protected SliderEndCircle(Slider slider)
{
this.slider = slider;
Slider = slider;
}
public int RepeatIndex { get; set; }
public double SpanDuration => slider.SpanDuration;
public double SpanDuration => Slider.SpanDuration;
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
{
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects
else
{
// The first end circle should fade in with the slider.
TimePreempt += StartTime - slider.StartTime;
TimePreempt += StartTime - Slider.StartTime;
}
}

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
pathVersion = drawableSlider.PathVersion.GetBoundCopy();
pathVersion.BindValueChanged(_ => Refresh());
pathVersion.BindValueChanged(_ => Scheduler.AddOnce(Refresh));
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);