Skip to content

Commit

Permalink
fix lacking hitobject updates in undo history
Browse files Browse the repository at this point in the history
  • Loading branch information
OliBomby committed Oct 12, 2024
1 parent c8e2adc commit 20ce649
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private void adjustLength(double proposedDistance, bool adjustVelocity)

Proxy.SetSliderVelocityMultiplier(proposedVelocity);
Proxy.Path().SetExpectedDistance(proposedDistance);
editorBeatmap?.Update(HitObject);
editorBeatmap?.AsCommandProxy(commandHandler).Update(HitObject);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public static CommandProxy<EditorBeatmap> Add(this CommandProxy<EditorBeatmap> p
public static CommandProxy<EditorBeatmap> Remove(this CommandProxy<EditorBeatmap> proxy, HitObject hitObject) =>
proxy.Submit(new RemoveHitObjectCommand(proxy.Target, hitObject));

public static CommandProxy<EditorBeatmap> Update(this CommandProxy<EditorBeatmap> proxy, HitObject hitObject) =>
proxy.Submit(new UpdateHitObjectCommand(proxy.Target, hitObject));

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Screens.Edit.Commands.Proxies;

namespace osu.Game.Screens.Edit.Compose.Components
{
Expand All @@ -26,6 +27,9 @@ public partial class EditorBlueprintContainer : BlueprintContainer<HitObject>
[Resolved]
protected EditorBeatmap Beatmap { get; private set; }

[Resolved(canBeNull: true)]
private EditorCommandHandler commandHandler { get; set; }

protected readonly HitObjectComposer Composer;

private HitObjectUsageEventBuffer usageEventBuffer;
Expand Down Expand Up @@ -88,8 +92,8 @@ protected override bool ApplySnapResult(SelectionBlueprint<HitObject>[] blueprin
{
Beatmap.PerformOnSelection(obj =>
{
obj.StartTime += offset;
Beatmap.Update(obj);
obj.AsCommandProxy(commandHandler).SetStartTime(obj.StartTime + offset);
Beatmap.AsCommandProxy(commandHandler).Update(obj);
});
}
}
Expand Down Expand Up @@ -119,8 +123,8 @@ protected override void DragOperationCompleted()
base.DragOperationCompleted();

// handle positional change etc.
foreach (var blueprint in SelectionBlueprints)
Beatmap.Update(blueprint.Item);
foreach (var blueprint in SelectionHandler.SelectedBlueprints)
Beatmap.AsCommandProxy(commandHandler).Update(blueprint.Item);
}

protected override bool OnDoubleClick(DoubleClickEvent e)
Expand Down

0 comments on commit 20ce649

Please sign in to comment.