mirror of
https://github.com/ppy/osu
synced 2025-03-20 09:57:01 +00:00
Make work for all editors based on track running state
This commit is contained in:
parent
53d542546e
commit
a5eac716ec
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -320,10 +321,22 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
foreach (var blueprint in SelectionBlueprints)
|
foreach (var blueprint in SelectionBlueprints)
|
||||||
{
|
{
|
||||||
if (blueprint.IsAlive && blueprint.IsPresent && rect.Contains(blueprint.ScreenSpaceSelectionPoint))
|
// only run when utmost necessary to avoid unnecessary rect computations.
|
||||||
blueprint.Select();
|
bool isValidForSelection() => blueprint.IsAlive && blueprint.IsPresent && rect.Contains(blueprint.ScreenSpaceSelectionPoint);
|
||||||
else
|
|
||||||
blueprint.Deselect();
|
switch (blueprint.State)
|
||||||
|
{
|
||||||
|
case SelectionState.NotSelected:
|
||||||
|
if (isValidForSelection())
|
||||||
|
blueprint.Select();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SelectionState.Selected:
|
||||||
|
// if the editor is playing, we generally don't want to deselect objects even if outside the selection area.
|
||||||
|
if (!editorClock.IsRunning && !isValidForSelection())
|
||||||
|
blueprint.Deselect();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user