mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27: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:
commit
2fdbc501c2
@ -51,10 +51,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
hitObjectPosition = hitObject.PositionBindable.GetBoundCopy();
|
hitObjectPosition = hitObject.PositionBindable.GetBoundCopy();
|
||||||
hitObjectPosition.BindValueChanged(_ => updateConnectingPath());
|
hitObjectPosition.BindValueChanged(_ => Scheduler.AddOnce(updateConnectingPath));
|
||||||
|
|
||||||
pathVersion = hitObject.Path.Version.GetBoundCopy();
|
pathVersion = hitObject.Path.Version.GetBoundCopy();
|
||||||
pathVersion.BindValueChanged(_ => updateConnectingPath());
|
pathVersion.BindValueChanged(_ => Scheduler.AddOnce(updateConnectingPath));
|
||||||
|
|
||||||
updateConnectingPath();
|
updateConnectingPath();
|
||||||
}
|
}
|
||||||
|
@ -244,6 +244,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
else if (slidingSample.IsPlaying)
|
else if (slidingSample.IsPlaying)
|
||||||
slidingSample.Stop();
|
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);
|
double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
repeatCount = value;
|
repeatCount = value;
|
||||||
updateNestedPositions();
|
endPositionCache.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
public Slider()
|
public Slider()
|
||||||
{
|
{
|
||||||
SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples();
|
SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples();
|
||||||
Path.Version.ValueChanged += _ => updateNestedPositions();
|
Path.Version.ValueChanged += _ => endPositionCache.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
|
@ -14,16 +14,16 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class SliderEndCircle : HitCircle
|
public abstract class SliderEndCircle : HitCircle
|
||||||
{
|
{
|
||||||
private readonly Slider slider;
|
protected readonly Slider Slider;
|
||||||
|
|
||||||
protected SliderEndCircle(Slider slider)
|
protected SliderEndCircle(Slider slider)
|
||||||
{
|
{
|
||||||
this.slider = slider;
|
Slider = slider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int RepeatIndex { get; set; }
|
public int RepeatIndex { get; set; }
|
||||||
|
|
||||||
public double SpanDuration => slider.SpanDuration;
|
public double SpanDuration => Slider.SpanDuration;
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
{
|
{
|
||||||
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The first end circle should fade in with the slider.
|
// The first end circle should fade in with the slider.
|
||||||
TimePreempt += StartTime - slider.StartTime;
|
TimePreempt += StartTime - Slider.StartTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
|
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
|
||||||
|
|
||||||
pathVersion = drawableSlider.PathVersion.GetBoundCopy();
|
pathVersion = drawableSlider.PathVersion.GetBoundCopy();
|
||||||
pathVersion.BindValueChanged(_ => Refresh());
|
pathVersion.BindValueChanged(_ => Scheduler.AddOnce(Refresh));
|
||||||
|
|
||||||
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
|
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
|
||||||
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
|
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user