mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Merge pull request #14864 from bdach/fix-range-selection-crash-after-keyboard-selection
Fix timeline range selection crashing after non-mouse selection
This commit is contained in:
commit
4958771fbf
@ -223,6 +223,41 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
moveMouseToObject(() => addedObjects[2]);
|
||||
AddStep("click first", () => InputManager.Click(MouseButton.Left));
|
||||
assertSelectionIs(addedObjects.Take(3));
|
||||
|
||||
AddStep("release keys", () =>
|
||||
{
|
||||
InputManager.ReleaseKey(Key.ControlLeft);
|
||||
InputManager.ReleaseKey(Key.ShiftLeft);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRangeSelectAfterExternalSelection()
|
||||
{
|
||||
var addedObjects = new[]
|
||||
{
|
||||
new HitCircle { StartTime = 100 },
|
||||
new HitCircle { StartTime = 200, Position = new Vector2(100) },
|
||||
new HitCircle { StartTime = 300, Position = new Vector2(200) },
|
||||
new HitCircle { StartTime = 400, Position = new Vector2(300) },
|
||||
};
|
||||
|
||||
AddStep("add hitobjects", () => EditorBeatmap.AddRange(addedObjects));
|
||||
|
||||
AddStep("select all without mouse", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects));
|
||||
assertSelectionIs(addedObjects);
|
||||
|
||||
AddStep("hold down shift", () => InputManager.PressKey(Key.ShiftLeft));
|
||||
|
||||
moveMouseToObject(() => addedObjects[1]);
|
||||
AddStep("click second object", () => InputManager.Click(MouseButton.Left));
|
||||
assertSelectionIs(addedObjects);
|
||||
|
||||
moveMouseToObject(() => addedObjects[3]);
|
||||
AddStep("click fourth object", () => InputManager.Click(MouseButton.Left));
|
||||
assertSelectionIs(addedObjects.Skip(1));
|
||||
|
||||
AddStep("release shift", () => InputManager.ReleaseKey(Key.ShiftLeft));
|
||||
}
|
||||
|
||||
private void assertSelectionIs(IEnumerable<HitObject> hitObjects)
|
||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
internal override bool MouseDownSelectionRequested(SelectionBlueprint<HitObject> blueprint, MouseButtonEvent e)
|
||||
{
|
||||
if (e.ShiftPressed && e.Button == MouseButton.Left && SelectedItems.Any())
|
||||
if (e.ShiftPressed && e.Button == MouseButton.Left && pivot != null)
|
||||
{
|
||||
handleRangeSelection(blueprint, e.ControlPressed);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user