1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Merge pull request #18754 from peppy/placement-object-use-last-sample-point

Fix new hitobject placements not taking on the existing sample settings
This commit is contained in:
Dan Balasescu 2022-06-18 14:46:00 +09:00 committed by GitHub
commit 24c78c24f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
#nullable disable
using System.Linq;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -73,6 +74,10 @@ namespace osu.Game.Rulesets.Edit
/// <param name="commitStart">Whether this call is committing a value for HitObject.StartTime and continuing with further adjustments.</param>
protected void BeginPlacement(bool commitStart = false)
{
var nearestSampleControlPoint = beatmap.HitObjects.LastOrDefault(h => h.GetEndTime() < HitObject.StartTime)?.SampleControlPoint?.DeepClone() as SampleControlPoint;
HitObject.SampleControlPoint = nearestSampleControlPoint ?? new SampleControlPoint();
placementHandler.BeginPlacement(HitObject);
if (commitStart)
PlacementActive = PlacementState.Active;