Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions osu.Game/Input/Bindings/GlobalActionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public static IEnumerable<GlobalAction> GetGlobalActionsFor(GlobalActionCategory
new KeyBinding(new[] { InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousBookmark),
new KeyBinding(new[] { InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextBookmark),
new KeyBinding(new[] { InputKey.Control, InputKey.L }, GlobalAction.EditorDiscardUnsavedChanges),
new KeyBinding(new[] { InputKey.Control, InputKey.I }, GlobalAction.EditorInvertSelection),
};

private static IEnumerable<KeyBinding> editorTestPlayKeyBindings => new[]
Expand Down Expand Up @@ -528,6 +529,9 @@ public enum GlobalAction

[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.NextSkin))]
NextSkin,

[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorInvertSelection))]
EditorInvertSelection,
}

public enum GlobalActionCategory
Expand Down
5 changes: 5 additions & 0 deletions osu.Game/Localisation/CommonStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public static class CommonStrings
/// </summary>
public static LocalisableString Clone => new TranslatableString(getKey(@"clone"), @"Clone");

/// <summary>
/// "Invert selection"
/// </summary>
public static LocalisableString InvertSelection => new TranslatableString(getKey(@"invert_selection"), @"Invert selection");

/// <summary>
/// "Exit"
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions osu.Game/Localisation/GlobalActionKeyBindingStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ public static class GlobalActionKeyBindingStrings
/// </summary>
public static LocalisableString EditorDiscardUnsavedChanges => new TranslatableString(getKey(@"editor_discard_unsaved_changes"), @"Discard unsaved changes");

/// <summary>
/// "Invert selection"
/// </summary>
public static LocalisableString EditorInvertSelection => new TranslatableString(getKey(@"editor_invert_selection"), @"Invert selection");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}
11 changes: 11 additions & 0 deletions osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
}

break;

case GlobalAction.EditorInvertSelection:
InvertSelection();
return true;
}

return false;
Expand Down Expand Up @@ -517,6 +521,13 @@ protected virtual void UpdateSelectionFromDragBox(HashSet<T> selectionBeforeDrag
/// </summary>
protected abstract void SelectAll();

/// <summary>
/// Invert the current selection, deselecting all selected items and selecting all unselected items.
/// </summary>
protected virtual void InvertSelection()
{
}

/// <summary>
/// Deselect all selected items.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ protected override void SelectAll()
SelectedItems.AddRange(Beatmap.HitObjects.Except(SelectedItems).ToArray());
}

protected override void InvertSelection()
{
Composer.Playfield.KeepAllAlive();

var toSelect = Beatmap.HitObjects.Except(SelectedItems).ToArray();

SelectedItems.Clear();
SelectedItems.AddRange(toSelect);
}

/// <summary>
/// Ensures that newly-selected hitobjects are kept alive
/// and drops that keep-alive from newly-deselected objects.
Expand Down
Loading