Force placement of in-progress object when changing tools in the editor

This commit is contained in:
Dean Herbert 2023-05-12 15:48:53 +09:00
parent f443cfb93e
commit 70e248b927

View File

@ -317,12 +317,16 @@ namespace osu.Game.Screens.Edit.Compose.Components
} }
} }
private void commitIfPlacementActive()
{
CurrentPlacement?.EndPlacement(CurrentPlacement.PlacementActive == PlacementBlueprint.PlacementState.Active);
removePlacement();
}
private void removePlacement() private void removePlacement()
{ {
if (CurrentPlacement == null) return; CurrentPlacement?.EndPlacement(false);
CurrentPlacement?.Expire();
CurrentPlacement.EndPlacement(false);
CurrentPlacement.Expire();
CurrentPlacement = null; CurrentPlacement = null;
} }
@ -342,7 +346,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
currentTool = value; currentTool = value;
refreshTool(); // As per stable editor, when changing tools, we should forcefully commit any pending placement.
commitIfPlacementActive();
} }
} }
} }