mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 09:42:54 +08:00
Rename Submit extension method to Apply
I think this fits better because it makes clear that this applies the change
This commit is contained in:
parent
9f62626bfa
commit
f0ab9f6128
@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
return;
|
||||
|
||||
if (segment.Count > 3)
|
||||
new PathControlPointTypeChange(first, PathType.BEZIER).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(first, PathType.BEZIER).Apply(changeHandler);
|
||||
|
||||
if (segment.Count != 3)
|
||||
return;
|
||||
@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
ReadOnlySpan<Vector2> points = segment.Select(p => p.Position).ToArray();
|
||||
RectangleF boundingBox = PathApproximator.CircularArcBoundingBox(points);
|
||||
if (boundingBox.Width >= 640 || boundingBox.Height >= 480)
|
||||
new PathControlPointTypeChange(first, PathType.BEZIER).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(first, PathType.BEZIER).Apply(changeHandler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -370,19 +370,19 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
int thirdPointIndex = indexInSegment + 2;
|
||||
|
||||
if (pointsInSegment.Count > thirdPointIndex + 1)
|
||||
new PathControlPointTypeChange(pointsInSegment[thirdPointIndex], pointsInSegment[0].Type).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(pointsInSegment[thirdPointIndex], pointsInSegment[0].Type).Apply(changeHandler);
|
||||
}
|
||||
|
||||
new ExpectedDistanceChange(hitObject.Path, null).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(p.ControlPoint, type).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(hitObject.Path, null).Apply(changeHandler);
|
||||
new PathControlPointTypeChange(p.ControlPoint, type).Apply(changeHandler);
|
||||
}
|
||||
|
||||
EnsureValidPathTypes();
|
||||
|
||||
if (hitObject.Path.Distance < originalDistance)
|
||||
new SnapToChange<T>(hitObject, distanceSnapProvider).Submit(changeHandler);
|
||||
new SnapToChange<T>(hitObject, distanceSnapProvider).Apply(changeHandler);
|
||||
else
|
||||
new ExpectedDistanceChange(hitObject.Path, originalDistance).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(hitObject.Path, originalDistance).Apply(changeHandler);
|
||||
|
||||
changeHandler?.EndChange();
|
||||
}
|
||||
@ -425,8 +425,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
|
||||
Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position;
|
||||
|
||||
new PositionChange(hitObject, hitObject.Position + movementDelta).Submit(changeHandler);
|
||||
new StartTimeChange(hitObject, result?.Time ?? hitObject.StartTime).Submit(changeHandler);
|
||||
new PositionChange(hitObject, hitObject.Position + movementDelta).Apply(changeHandler);
|
||||
new StartTimeChange(hitObject, result?.Time ?? hitObject.StartTime).Apply(changeHandler);
|
||||
|
||||
for (int i = 1; i < hitObject.Path.ControlPoints.Count; i++)
|
||||
{
|
||||
@ -436,7 +436,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
// All other selected control points (if any) will move together with the head point
|
||||
// (and so they will not move at all, relative to each other).
|
||||
if (!selectedControlPoints.Contains(controlPoint))
|
||||
new PathControlPointPositionChange(controlPoint, controlPoint.Position - movementDelta).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(controlPoint, controlPoint.Position - movementDelta).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -449,28 +449,28 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
{
|
||||
PathControlPoint controlPoint = controlPoints[i];
|
||||
if (selectedControlPoints.Contains(controlPoint))
|
||||
new PathControlPointPositionChange(controlPoint, dragStartPositions[i] + movementDelta).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(controlPoint, dragStartPositions[i] + movementDelta).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
// Snap the path to the current beat divisor before checking length validity.
|
||||
new SnapToChange<T>(hitObject, distanceSnapProvider).Submit(changeHandler);
|
||||
new SnapToChange<T>(hitObject, distanceSnapProvider).Apply(changeHandler);
|
||||
|
||||
if (!hitObject.Path.HasValidLength)
|
||||
{
|
||||
for (int i = 0; i < hitObject.Path.ControlPoints.Count; i++)
|
||||
new PathControlPointPositionChange(hitObject.Path.ControlPoints[i], oldControlPoints[i]).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(hitObject.Path.ControlPoints[i], oldControlPoints[i]).Apply(changeHandler);
|
||||
|
||||
new PositionChange(hitObject, oldPosition).Submit(changeHandler);
|
||||
new StartTimeChange(hitObject, oldStartTime).Submit(changeHandler);
|
||||
new PositionChange(hitObject, oldPosition).Apply(changeHandler);
|
||||
new StartTimeChange(hitObject, oldStartTime).Apply(changeHandler);
|
||||
// Snap the path length again to undo the invalid length.
|
||||
new SnapToChange<T>(hitObject, distanceSnapProvider).Submit(changeHandler);
|
||||
new SnapToChange<T>(hitObject, distanceSnapProvider).Apply(changeHandler);
|
||||
return;
|
||||
}
|
||||
|
||||
// Maintain the path types in case they got defaulted to bezier at some point during the drag.
|
||||
for (int i = 0; i < hitObject.Path.ControlPoints.Count; i++)
|
||||
new PathControlPointTypeChange(hitObject.Path.ControlPoints[i], dragPathTypes[i]).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(hitObject.Path.ControlPoints[i], dragPathTypes[i]).Apply(changeHandler);
|
||||
|
||||
EnsureValidPathTypes();
|
||||
}
|
||||
|
@ -280,9 +280,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
if (Precision.AlmostEquals(proposedDistance, HitObject.Path.Distance) && Precision.AlmostEquals(proposedVelocity, HitObject.SliderVelocityMultiplier))
|
||||
return;
|
||||
|
||||
new SliderVelocityMultiplierChange(HitObject, proposedVelocity).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(HitObject.Path, proposedDistance).Submit(changeHandler);
|
||||
new QueueUpdateHitObject(editorBeatmap, HitObject).Submit(changeHandler);
|
||||
new SliderVelocityMultiplierChange(HitObject, proposedVelocity).Apply(changeHandler);
|
||||
new ExpectedDistanceChange(HitObject.Path, proposedDistance).Apply(changeHandler);
|
||||
new QueueUpdateHitObject(editorBeatmap, HitObject).Apply(changeHandler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -303,8 +303,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
if (Precision.AlmostBigger(segmentEnds[segmentIndex], 1, 1E-3))
|
||||
{
|
||||
new RemoveRangePathControlPointChange(sliderPath.ControlPoints, i + 1, sliderPath.ControlPoints.Count - i - 1).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(sliderPath.ControlPoints[^1], null).Submit(changeHandler);
|
||||
new RemoveRangePathControlPointChange(sliderPath.ControlPoints, i + 1, sliderPath.ControlPoints.Count - i - 1).Apply(changeHandler);
|
||||
new PathControlPointTypeChange(sliderPath.ControlPoints[^1], null).Apply(changeHandler);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -439,11 +439,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
var pathControlPoint = new PathControlPoint { Position = position };
|
||||
|
||||
// Move the control points from the insertion index onwards to make room for the insertion
|
||||
new InsertPathControlPointChange(HitObject.Path.ControlPoints, insertionIndex, pathControlPoint).Submit(changeHandler);
|
||||
new InsertPathControlPointChange(HitObject.Path.ControlPoints, insertionIndex, pathControlPoint).Apply(changeHandler);
|
||||
|
||||
ControlPointVisualiser?.EnsureValidPathTypes();
|
||||
|
||||
new SnapToChange<Slider>(HitObject, distanceSnapProvider).Submit(changeHandler);
|
||||
new SnapToChange<Slider>(HitObject, distanceSnapProvider).Apply(changeHandler);
|
||||
|
||||
return pathControlPoint;
|
||||
}
|
||||
@ -459,15 +459,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
// The first control point in the slider must have a type, so take it from the previous "first" one
|
||||
// Todo: Should be handled within SliderPath itself
|
||||
if (c == controlPoints[0] && controlPoints.Count > 1 && controlPoints[1].Type == null)
|
||||
new PathControlPointTypeChange(controlPoints[1], controlPoints[0].Type).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(controlPoints[1], controlPoints[0].Type).Apply(changeHandler);
|
||||
|
||||
new RemovePathControlPointChange(HitObject.Path.ControlPoints, c).Submit(changeHandler);
|
||||
new RemovePathControlPointChange(HitObject.Path.ControlPoints, c).Apply(changeHandler);
|
||||
}
|
||||
|
||||
ControlPointVisualiser?.EnsureValidPathTypes();
|
||||
|
||||
// Snap the slider to the current beat divisor before checking length validity.
|
||||
new SnapToChange<Slider>(HitObject, distanceSnapProvider).Submit(changeHandler);
|
||||
new SnapToChange<Slider>(HitObject, distanceSnapProvider).Apply(changeHandler);
|
||||
|
||||
// If there are 0 or 1 remaining control points, or the slider has an invalid length, it is in a degenerate form and should be deleted
|
||||
if (controlPoints.Count <= 1 || !HitObject.Path.HasValidLength)
|
||||
@ -480,9 +480,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
// So the slider needs to be offset by this amount instead, and all control points offset backwards such that the path is re-positioned at (0, 0)
|
||||
Vector2 first = controlPoints[0].Position;
|
||||
foreach (var c in controlPoints)
|
||||
new PathControlPointPositionChange(c, c.Position - first).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(c, c.Position - first).Apply(changeHandler);
|
||||
|
||||
new PositionChange(HitObject, HitObject.Position + first).Submit(changeHandler);
|
||||
new PositionChange(HitObject, HitObject.Position + first).Apply(changeHandler);
|
||||
}
|
||||
|
||||
private void splitControlPoints(List<PathControlPoint> controlPointsToSplitAt)
|
||||
@ -512,7 +512,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
// Extract the split portion and remove from the original slider.
|
||||
var splitControlPoints = controlPoints.Take(index + 1).ToList();
|
||||
new RemoveRangePathControlPointChange(HitObject.Path.ControlPoints, 0, index).Submit(changeHandler);
|
||||
new RemoveRangePathControlPointChange(HitObject.Path.ControlPoints, 0, index).Apply(changeHandler);
|
||||
|
||||
var newSlider = new Slider
|
||||
{
|
||||
@ -526,18 +526,18 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
};
|
||||
|
||||
// Increase the start time of the slider before adding the new slider so the new slider is immediately inserted at the correct index and internal state remains valid.
|
||||
new StartTimeChange(HitObject, HitObject.StartTime + split_gap).Submit(changeHandler);
|
||||
new StartTimeChange(HitObject, HitObject.StartTime + split_gap).Apply(changeHandler);
|
||||
|
||||
new AddHitObjectChange(editorBeatmap, newSlider).Submit(changeHandler);
|
||||
new AddHitObjectChange(editorBeatmap, newSlider).Apply(changeHandler);
|
||||
|
||||
new NewComboChange(HitObject, false).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(HitObject.Path, HitObject.Path.ExpectedDistance.Value - newSlider.Path.CalculatedDistance).Submit(changeHandler);
|
||||
new StartTimeChange(HitObject, HitObject.StartTime + newSlider.SpanDuration).Submit(changeHandler);
|
||||
new NewComboChange(HitObject, false).Apply(changeHandler);
|
||||
new ExpectedDistanceChange(HitObject.Path, HitObject.Path.ExpectedDistance.Value - newSlider.Path.CalculatedDistance).Apply(changeHandler);
|
||||
new StartTimeChange(HitObject, HitObject.StartTime + newSlider.SpanDuration).Apply(changeHandler);
|
||||
|
||||
// In case the remainder of the slider has no length left over, give it length anyways so we don't get a 0 length slider.
|
||||
if (HitObject.Path.ExpectedDistance.Value <= Precision.DOUBLE_EPSILON)
|
||||
{
|
||||
new ExpectedDistanceChange(HitObject.Path, null).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(HitObject.Path, null).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,9 +545,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
// As a final step, we must reset its control points to have an origin of (0,0).
|
||||
Vector2 first = controlPoints[0].Position;
|
||||
foreach (var c in controlPoints)
|
||||
new PathControlPointPositionChange(c, c.Position - first).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(c, c.Position - first).Apply(changeHandler);
|
||||
|
||||
new PositionChange(HitObject, HitObject.Position + first).Submit(changeHandler);
|
||||
new PositionChange(HitObject, HitObject.Position + first).Apply(changeHandler);
|
||||
}
|
||||
|
||||
private void convertToStream()
|
||||
@ -581,13 +581,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
Position = position,
|
||||
NewCombo = i == 0 && HitObject.NewCombo,
|
||||
Samples = HitObject.HeadCircle.Samples.Select(s => s.With()).ToList()
|
||||
}).Submit(changeHandler);
|
||||
}).Apply(changeHandler);
|
||||
|
||||
i += 1;
|
||||
time = HitObject.StartTime + i * streamSpacing;
|
||||
}
|
||||
|
||||
new RemoveHitObjectChange(editorBeatmap, HitObject).Submit(changeHandler);
|
||||
new RemoveHitObjectChange(editorBeatmap, HitObject).Apply(changeHandler);
|
||||
|
||||
changeHandler?.EndChange();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
// this will potentially move the selection out of bounds...
|
||||
foreach (var h in hitObjects)
|
||||
new PositionChange(h, h.Position + localDelta).Submit(changeHandler);
|
||||
new PositionChange(h, h.Position + localDelta).Apply(changeHandler);
|
||||
|
||||
// but this will be corrected.
|
||||
moveSelectionInBounds();
|
||||
@ -111,13 +111,13 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
foreach (var h in hitObjects)
|
||||
{
|
||||
if (moreThanOneObject)
|
||||
new StartTimeChange(h, endTime - (h.GetEndTime() - startTime)).Submit(changeHandler);
|
||||
new StartTimeChange(h, endTime - (h.GetEndTime() - startTime)).Apply(changeHandler);
|
||||
|
||||
if (h is Slider slider)
|
||||
{
|
||||
var reverse = new ReverseSliderPathChange(slider.Path);
|
||||
reverse.Submit(changeHandler);
|
||||
new PositionChange(slider, slider.Position + reverse.PositionalOffset).Submit(changeHandler);
|
||||
reverse.Apply(changeHandler);
|
||||
new PositionChange(slider, slider.Position + reverse.PositionalOffset).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
hitObjects = hitObjects.OrderBy(obj => obj.StartTime).ToList();
|
||||
|
||||
for (int i = 0; i < hitObjects.Count; ++i)
|
||||
new NewComboChange(hitObjects[i], newComboOrder[i]).Submit(changeHandler);
|
||||
new NewComboChange(hitObjects[i], newComboOrder[i]).Apply(changeHandler);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -174,7 +174,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
if (!Precision.AlmostEquals(flippedPosition, h.Position))
|
||||
{
|
||||
new PositionChange(h, flippedPosition).Submit(changeHandler);
|
||||
new PositionChange(h, flippedPosition).Apply(changeHandler);
|
||||
didFlip = true;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
didFlip = true;
|
||||
|
||||
foreach (var cp in slider.Path.ControlPoints)
|
||||
new PathControlPointPositionChange(cp, GeometryUtils.GetFlippedPosition(flipAxis, controlPointFlipQuad, cp.Position)).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(cp, GeometryUtils.GetFlippedPosition(flipAxis, controlPointFlipQuad, cp.Position)).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
delta.Y -= quad.BottomRight.Y - DrawHeight;
|
||||
|
||||
foreach (var h in hitObjects)
|
||||
new PositionChange(h, h.Position + delta).Submit(changeHandler);
|
||||
new PositionChange(h, h.Position + delta).Apply(changeHandler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -252,7 +252,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
if (mergedHitObject.Path.ControlPoints.Count == 0)
|
||||
{
|
||||
new InsertPathControlPointChange(mergedHitObject.Path.ControlPoints, mergedHitObject.Path.ControlPoints.Count, new PathControlPoint(Vector2.Zero, PathType.LINEAR)).Submit(changeHandler);
|
||||
new InsertPathControlPointChange(mergedHitObject.Path.ControlPoints, mergedHitObject.Path.ControlPoints.Count, new PathControlPoint(Vector2.Zero, PathType.LINEAR)).Apply(changeHandler);
|
||||
}
|
||||
|
||||
// Merge all the selected hit objects into one slider path.
|
||||
@ -266,15 +266,15 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
float distanceToLastControlPoint = Vector2.Distance(mergedHitObject.Path.ControlPoints[^1].Position, offset);
|
||||
|
||||
// Calculate the distance required to travel to the expected distance of the merging slider.
|
||||
new ExpectedDistanceChange(mergedHitObject.Path, mergedHitObject.Path.CalculatedDistance + distanceToLastControlPoint + hasPath.Path.Distance).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(mergedHitObject.Path, mergedHitObject.Path.CalculatedDistance + distanceToLastControlPoint + hasPath.Path.Distance).Apply(changeHandler);
|
||||
|
||||
// Remove the last control point if it sits exactly on the start of the next control point.
|
||||
if (Precision.AlmostEquals(distanceToLastControlPoint, 0))
|
||||
{
|
||||
new RemovePathControlPointChange(mergedHitObject.Path.ControlPoints, mergedHitObject.Path.ControlPoints.Count - 1).Submit(changeHandler);
|
||||
new RemovePathControlPointChange(mergedHitObject.Path.ControlPoints, mergedHitObject.Path.ControlPoints.Count - 1).Apply(changeHandler);
|
||||
}
|
||||
|
||||
new AddRangePathControlPointChange(mergedHitObject.Path.ControlPoints, hasPath.Path.ControlPoints.Select(o => new PathControlPoint(o.Position + offset, o.Type))).Submit(changeHandler);
|
||||
new AddRangePathControlPointChange(mergedHitObject.Path.ControlPoints, hasPath.Path.ControlPoints.Select(o => new PathControlPoint(o.Position + offset, o.Type))).Apply(changeHandler);
|
||||
lastCircle = false;
|
||||
}
|
||||
else
|
||||
@ -282,11 +282,11 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
// Turn the last control point into a linear type if this is the first merging circle in a sequence, so the subsequent control points can be inherited path type.
|
||||
if (!lastCircle)
|
||||
{
|
||||
new PathControlPointTypeChange(mergedHitObject.Path.ControlPoints.Last(), PathType.LINEAR).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(mergedHitObject.Path.ControlPoints.Last(), PathType.LINEAR).Apply(changeHandler);
|
||||
}
|
||||
|
||||
new InsertPathControlPointChange(mergedHitObject.Path.ControlPoints, mergedHitObject.Path.ControlPoints.Count, new PathControlPoint(selectedMergeableObject.Position - mergedHitObject.Position)).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(mergedHitObject.Path, null).Submit(changeHandler);
|
||||
new InsertPathControlPointChange(mergedHitObject.Path.ControlPoints, mergedHitObject.Path.ControlPoints.Count, new PathControlPoint(selectedMergeableObject.Position - mergedHitObject.Position)).Apply(changeHandler);
|
||||
new ExpectedDistanceChange(mergedHitObject.Path, null).Apply(changeHandler);
|
||||
lastCircle = true;
|
||||
}
|
||||
}
|
||||
@ -296,17 +296,17 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
foreach (var selectedMergeableObject in mergeableObjects.Skip(1))
|
||||
{
|
||||
new RemoveHitObjectChange(EditorBeatmap, selectedMergeableObject).Submit(changeHandler);
|
||||
new RemoveHitObjectChange(EditorBeatmap, selectedMergeableObject).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var selectedMergeableObject in mergeableObjects)
|
||||
{
|
||||
new RemoveHitObjectChange(EditorBeatmap, selectedMergeableObject).Submit(changeHandler);
|
||||
new RemoveHitObjectChange(EditorBeatmap, selectedMergeableObject).Apply(changeHandler);
|
||||
}
|
||||
|
||||
new AddHitObjectChange(EditorBeatmap, mergedHitObject).Submit(changeHandler);
|
||||
new AddHitObjectChange(EditorBeatmap, mergedHitObject).Apply(changeHandler);
|
||||
}
|
||||
|
||||
// Make sure the merged hitobject is selected.
|
||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
foreach (var ho in objectsInRotation)
|
||||
{
|
||||
new PositionChange(ho, GeometryUtils.RotatePointAroundOrigin(originalPositions[ho], actualOrigin, rotation)).Submit(changeHandler);
|
||||
new PositionChange(ho, GeometryUtils.RotatePointAroundOrigin(originalPositions[ho], actualOrigin, rotation)).Apply(changeHandler);
|
||||
|
||||
if (ho is IHasPath withPath)
|
||||
{
|
||||
@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
for (int i = 0; i < withPath.Path.ControlPoints.Count; ++i)
|
||||
{
|
||||
new PathControlPointPositionChange(withPath.Path.ControlPoints[i],
|
||||
GeometryUtils.RotatePointAroundOrigin(originalPath[i], Vector2.Zero, rotation)).Submit(changeHandler);
|
||||
GeometryUtils.RotatePointAroundOrigin(originalPath[i], Vector2.Zero, rotation)).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
foreach (var (ho, originalState) in objectsInScale)
|
||||
{
|
||||
new PositionChange(ho, GeometryUtils.GetScaledPosition(scale, actualOrigin, originalState.Position, axisRotation)).Submit(changeHandler);
|
||||
new PositionChange(ho, GeometryUtils.GetScaledPosition(scale, actualOrigin, originalState.Position, axisRotation)).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,15 +169,15 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
for (int i = 0; i < slider.Path.ControlPoints.Count; i++)
|
||||
{
|
||||
new PathControlPointPositionChange(slider.Path.ControlPoints[i],
|
||||
GeometryUtils.GetScaledPosition(scale, Vector2.Zero, originalInfo.PathControlPointPositions[i], axisRotation)).Submit(changeHandler);
|
||||
new PathControlPointTypeChange(slider.Path.ControlPoints[i], originalInfo.PathControlPointTypes[i]).Submit(changeHandler);
|
||||
GeometryUtils.GetScaledPosition(scale, Vector2.Zero, originalInfo.PathControlPointPositions[i], axisRotation)).Apply(changeHandler);
|
||||
new PathControlPointTypeChange(slider.Path.ControlPoints[i], originalInfo.PathControlPointTypes[i]).Apply(changeHandler);
|
||||
}
|
||||
|
||||
// Snap the slider's length to the current beat divisor
|
||||
// to calculate the final resulting duration / bounding box before the final checks.
|
||||
new SnapToChange<Slider>(slider, snapProvider).Submit(changeHandler);
|
||||
new SnapToChange<Slider>(slider, snapProvider).Apply(changeHandler);
|
||||
|
||||
new PositionChange(slider, GeometryUtils.GetScaledPosition(scale, origin, originalInfo.Position, axisRotation)).Submit(changeHandler);
|
||||
new PositionChange(slider, GeometryUtils.GetScaledPosition(scale, origin, originalInfo.Position, axisRotation)).Apply(changeHandler);
|
||||
|
||||
//if sliderhead or sliderend end up outside playfield, revert scaling.
|
||||
Quad scaledQuad = GeometryUtils.GetSurroundingQuad(new OsuHitObject[] { slider });
|
||||
@ -188,13 +188,13 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
for (int i = 0; i < slider.Path.ControlPoints.Count; i++)
|
||||
{
|
||||
new PathControlPointPositionChange(slider.Path.ControlPoints[i], originalInfo.PathControlPointPositions[i]).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(slider.Path.ControlPoints[i], originalInfo.PathControlPointPositions[i]).Apply(changeHandler);
|
||||
}
|
||||
|
||||
new PositionChange(slider, originalInfo.Position).Submit(changeHandler);
|
||||
new PositionChange(slider, originalInfo.Position).Apply(changeHandler);
|
||||
|
||||
// Snap the slider's length again to undo the potentially-invalid length applied by the previous snap.
|
||||
new SnapToChange<Slider>(slider, snapProvider).Submit(changeHandler);
|
||||
new SnapToChange<Slider>(slider, snapProvider).Apply(changeHandler);
|
||||
}
|
||||
|
||||
private (bool X, bool Y) isQuadInBounds(Quad quad)
|
||||
@ -297,7 +297,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
delta.Y -= quad.BottomRight.Y - OsuPlayfield.BASE_SIZE.Y;
|
||||
|
||||
foreach (var (h, _) in objectsInScale!)
|
||||
new PositionChange(h, h.Position + delta).Submit(changeHandler);
|
||||
new PositionChange(h, h.Position + delta).Apply(changeHandler);
|
||||
}
|
||||
|
||||
private struct OriginalHitObjectState
|
||||
|
@ -499,14 +499,14 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
if (commit)
|
||||
{
|
||||
new AddHitObjectChange(EditorBeatmap, hitObject).Submit(changeHandler);
|
||||
new AddHitObjectChange(EditorBeatmap, hitObject).Apply(changeHandler);
|
||||
|
||||
if (autoSeekOnPlacement.Value && EditorClock.CurrentTime < hitObject.StartTime)
|
||||
EditorClock.SeekSmoothlyTo(hitObject.StartTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(HitObject hitObject) => new RemoveHitObjectChange(EditorBeatmap, hitObject).Submit(changeHandler);
|
||||
public void Delete(HitObject hitObject) => new RemoveHitObjectChange(EditorBeatmap, hitObject).Apply(changeHandler);
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
where THitObject : HitObject, IHasPath
|
||||
{
|
||||
double newDistance = snapProvider?.FindSnappedDistance(hitObject, (float)hitObject.Path.CalculatedDistance, DistanceSnapTarget.Start) ?? hitObject.Path.CalculatedDistance;
|
||||
new ExpectedDistanceChange(hitObject.Path, newDistance).Submit(changeHandler);
|
||||
new ExpectedDistanceChange(hitObject.Path, newDistance).Apply(changeHandler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
|
||||
// Inherited points after a linear point, as well as the first control point if it inherited,
|
||||
// should be treated as linear points, so their types are temporarily changed to linear.
|
||||
inheritedLinearPoints.ForEach(p => new PathControlPointTypeChange(p, PathType.LINEAR).Submit(changeHandler));
|
||||
inheritedLinearPoints.ForEach(p => new PathControlPointTypeChange(p, PathType.LINEAR).Apply(changeHandler));
|
||||
|
||||
double[] segmentEnds = sliderPath.GetSegmentEnds().ToArray();
|
||||
|
||||
@ -51,11 +51,11 @@ namespace osu.Game.Rulesets.Objects
|
||||
segmentEnds = segmentEnds[..^1];
|
||||
}
|
||||
|
||||
new RemovePathControlPointChange(controlPoints, controlPoints.Count - 1).Submit(changeHandler);
|
||||
new RemovePathControlPointChange(controlPoints, controlPoints.Count - 1).Apply(changeHandler);
|
||||
}
|
||||
|
||||
// Restore original control point types.
|
||||
inheritedLinearPoints.ForEach(p => new PathControlPointTypeChange(p, null).Submit(changeHandler));
|
||||
inheritedLinearPoints.ForEach(p => new PathControlPointTypeChange(p, null).Apply(changeHandler));
|
||||
|
||||
// Recalculate middle perfect curve control points at the end of the slider path.
|
||||
if (controlPoints.Count >= 3 && controlPoints[^3].Type == PathType.PERFECT_CURVE && controlPoints[^2].Type == null && segmentEnds.Any())
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
var circleArcPath = new List<Vector2>();
|
||||
sliderPath.GetPathToProgress(circleArcPath, lastSegmentStart / lastSegmentEnd, 1);
|
||||
|
||||
new PathControlPointPositionChange(controlPoints[^2], circleArcPath[circleArcPath.Count / 2]).Submit(changeHandler);
|
||||
new PathControlPointPositionChange(controlPoints[^2], circleArcPath[circleArcPath.Count / 2]).Apply(changeHandler);
|
||||
}
|
||||
|
||||
sliderPath.reverseControlPoints(out positionalOffset, changeHandler);
|
||||
@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
else if (p.Type != null)
|
||||
(p.Type, lastType) = (lastType, p.Type);
|
||||
|
||||
new InsertPathControlPointChange(sliderPath.ControlPoints, 0, p).Submit(changeHandler);
|
||||
new InsertPathControlPointChange(sliderPath.ControlPoints, 0, p).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
public static void SubmitRemoveRange(this BindableList<PathControlPoint> controlPoints, int startIndex, int count, NewBeatmapEditorChangeHandler? changeHandler)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
new RemovePathControlPointChange(controlPoints, startIndex).Submit(changeHandler);
|
||||
new RemovePathControlPointChange(controlPoints, startIndex).Apply(changeHandler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
public static void SubmitAddRange(this BindableList<PathControlPoint> controlPoints, IEnumerable<PathControlPoint> points, NewBeatmapEditorChangeHandler? changeHandler)
|
||||
{
|
||||
foreach (var point in points)
|
||||
new InsertPathControlPointChange(controlPoints, controlPoints.Count, point).Submit(changeHandler);
|
||||
new InsertPathControlPointChange(controlPoints, controlPoints.Count, point).Apply(changeHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Edit.Changes
|
||||
|
||||
public static class IRevertibleChangeExtension
|
||||
{
|
||||
public static void Submit(this IRevertibleChange change, NewBeatmapEditorChangeHandler? changeHandler, bool commitImmediately = false)
|
||||
public static void Apply(this IRevertibleChange change, NewBeatmapEditorChangeHandler? changeHandler, bool commitImmediately = false)
|
||||
{
|
||||
if (changeHandler != null)
|
||||
changeHandler.Submit(change, commitImmediately);
|
||||
|
@ -92,8 +92,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
Beatmap.PerformOnSelection(obj =>
|
||||
{
|
||||
new StartTimeChange(obj, obj.StartTime + offset).Submit(changeHandler);
|
||||
new QueueUpdateHitObject(Beatmap, obj).Submit(changeHandler);
|
||||
new StartTimeChange(obj, obj.StartTime + offset).Apply(changeHandler);
|
||||
new QueueUpdateHitObject(Beatmap, obj).Apply(changeHandler);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -124,7 +124,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
// handle positional change etc.
|
||||
foreach (var blueprint in SelectionBlueprints)
|
||||
new QueueUpdateHitObject(Beatmap, blueprint.Item).Submit(changeHandler);
|
||||
new QueueUpdateHitObject(Beatmap, blueprint.Item).Apply(changeHandler);
|
||||
}
|
||||
|
||||
protected override bool OnDoubleClick(DoubleClickEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user