1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 05:12:55 +08:00

Merge remote-tracking branch 'upstream'

This commit is contained in:
jvyden 2021-04-18 23:04:35 -04:00
commit e44d11667c
No known key found for this signature in database
GPG Key ID: 18BCF2BE0262B278
5 changed files with 32 additions and 6 deletions

View File

@ -3,12 +3,16 @@
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Beatmaps;
using osuTK; using osuTK;
@ -110,8 +114,9 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("duration matches", () => ((Spinner)EditorBeatmap.HitObjects.Single()).Duration == 5000); AddAssert("duration matches", () => ((Spinner)EditorBeatmap.HitObjects.Single()).Duration == 5000);
} }
[Test] [TestCase(false)]
public void TestCopyPaste() [TestCase(true)]
public void TestCopyPaste(bool deselectAfterCopy)
{ {
var addedObject = new HitCircle { StartTime = 1000 }; var addedObject = new HitCircle { StartTime = 1000 };
@ -123,11 +128,22 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("move forward in time", () => EditorClock.Seek(2000)); AddStep("move forward in time", () => EditorClock.Seek(2000));
if (deselectAfterCopy)
{
AddStep("deselect", () => EditorBeatmap.SelectedHitObjects.Clear());
AddUntilStep("timeline selection box is not visible", () => Editor.ChildrenOfType<Timeline>().First().ChildrenOfType<SelectionHandler>().First().Alpha == 0);
AddUntilStep("composer selection box is not visible", () => Editor.ChildrenOfType<HitObjectComposer>().First().ChildrenOfType<SelectionHandler>().First().Alpha == 0);
}
AddStep("paste hitobject", () => Editor.Paste()); AddStep("paste hitobject", () => Editor.Paste());
AddAssert("are two objects", () => EditorBeatmap.HitObjects.Count == 2); AddAssert("are two objects", () => EditorBeatmap.HitObjects.Count == 2);
AddAssert("new object selected", () => EditorBeatmap.SelectedHitObjects.Single().StartTime == 2000); AddAssert("new object selected", () => EditorBeatmap.SelectedHitObjects.Single().StartTime == 2000);
AddUntilStep("timeline selection box is visible", () => Editor.ChildrenOfType<Timeline>().First().ChildrenOfType<SelectionHandler>().First().Alpha > 0);
AddUntilStep("composer selection box is visible", () => Editor.ChildrenOfType<HitObjectComposer>().First().ChildrenOfType<SelectionHandler>().First().Alpha > 0);
} }
[Test] [Test]

View File

@ -27,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddInternal(checkmark = new SpriteIcon Add(checkmark = new SpriteIcon
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -44,6 +44,9 @@ namespace osu.Game.Overlays.Volume
protected override bool OnScroll(ScrollEvent e) protected override bool OnScroll(ScrollEvent e)
{ {
if (e.ScrollDelta.Y == 0)
return false;
// forward any unhandled mouse scroll events to the volume control. // forward any unhandled mouse scroll events to the volume control.
ScrollActionRequested?.Invoke(GlobalAction.IncreaseVolume, e.ScrollDelta.Y, e.IsPrecise); ScrollActionRequested?.Invoke(GlobalAction.IncreaseVolume, e.ScrollDelta.Y, e.IsPrecise);
return true; return true;

View File

@ -245,6 +245,9 @@ namespace osu.Game.Overlays.Volume
private void adjust(double delta, bool isPrecise) private void adjust(double delta, bool isPrecise)
{ {
if (delta == 0)
return;
// every adjust increment increases the rate at which adjustments happen up to a cutoff. // every adjust increment increases the rate at which adjustments happen up to a cutoff.
// this debounce will reset on inactivity. // this debounce will reset on inactivity.
accelerationDebounce?.Cancel(); accelerationDebounce?.Cancel();

View File

@ -33,10 +33,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary> /// </summary>
public class SelectionHandler : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IHasContextMenu public class SelectionHandler : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IHasContextMenu
{ {
/// <summary>
/// The currently selected blueprints.
/// Should be used when operations are dealing directly with the visible blueprints.
/// For more general selection operations, use <see cref="osu.Game.Screens.Edit.EditorBeatmap.SelectedHitObjects"/> instead.
/// </summary>
public IEnumerable<SelectionBlueprint> SelectedBlueprints => selectedBlueprints; public IEnumerable<SelectionBlueprint> SelectedBlueprints => selectedBlueprints;
private readonly List<SelectionBlueprint> selectedBlueprints;
public int SelectedCount => selectedBlueprints.Count; private readonly List<SelectionBlueprint> selectedBlueprints;
private Drawable content; private Drawable content;
@ -295,7 +299,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary> /// </summary>
private void updateVisibility() private void updateVisibility()
{ {
int count = selectedBlueprints.Count; int count = EditorBeatmap.SelectedHitObjects.Count;
selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty; selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty;