mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00:00
Merge pull request #25304 from peppy/fix-click-through-timeline
Fix right clicks on timeline potentially not working as expected
This commit is contained in:
commit
30ffb15868
@ -7,8 +7,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -44,6 +46,47 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestContextMenuWithObjectBehind()
|
||||
{
|
||||
TimelineHitObjectBlueprint blueprint;
|
||||
|
||||
AddStep("add object", () =>
|
||||
{
|
||||
EditorBeatmap.Add(new HitCircle { StartTime = 3000 });
|
||||
});
|
||||
|
||||
AddStep("enter slider placement", () =>
|
||||
{
|
||||
InputManager.Key(Key.Number3);
|
||||
InputManager.MoveMouseTo(ScreenSpaceDrawQuad.Centre);
|
||||
});
|
||||
|
||||
AddStep("start conflicting slider", () =>
|
||||
{
|
||||
InputManager.Click(MouseButton.Left);
|
||||
|
||||
blueprint = this.ChildrenOfType<TimelineHitObjectBlueprint>().First();
|
||||
InputManager.MoveMouseTo(blueprint.ScreenSpaceDrawQuad.TopLeft - new Vector2(10, 0));
|
||||
});
|
||||
|
||||
AddStep("end conflicting slider", () =>
|
||||
{
|
||||
InputManager.Click(MouseButton.Right);
|
||||
});
|
||||
|
||||
AddStep("click object", () =>
|
||||
{
|
||||
InputManager.Key(Key.Number1);
|
||||
blueprint = this.ChildrenOfType<TimelineHitObjectBlueprint>().First();
|
||||
InputManager.MoveMouseTo(blueprint);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddStep("right click", () => InputManager.Click(MouseButton.Right));
|
||||
AddAssert("context menu open", () => this.ChildrenOfType<OsuContextMenu>().SingleOrDefault()?.State == MenuState.Open);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNudgeSelection()
|
||||
{
|
||||
@ -139,7 +182,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
AddStep("click away", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(Editor.ChildrenOfType<TimelineArea>().Single().ScreenSpaceDrawQuad.TopLeft + Vector2.One);
|
||||
InputManager.MoveMouseTo(Editor.ChildrenOfType<Timeline>().First().ScreenSpaceDrawQuad.TopLeft + new Vector2(5));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
|
@ -40,11 +40,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
public PlacementBlueprint CurrentPlacement { get; private set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private EditorScreenWithTimeline editorScreen { get; set; }
|
||||
|
||||
/// <remarks>
|
||||
/// Positional input must be received outside the container's bounds,
|
||||
/// in order to handle composer blueprints which are partially offscreen.
|
||||
/// </remarks>
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => editorScreen?.MainContent.ReceivePositionalInputAt(screenSpacePos) ?? base.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
public ComposeBlueprintContainer(HitObjectComposer composer)
|
||||
: base(composer)
|
||||
|
@ -11,13 +11,14 @@ using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
|
||||
namespace osu.Game.Screens.Edit
|
||||
{
|
||||
[Cached]
|
||||
public abstract partial class EditorScreenWithTimeline : EditorScreen
|
||||
{
|
||||
public const float PADDING = 10;
|
||||
|
||||
private Container timelineContainer = null!;
|
||||
public Container TimelineContent { get; private set; } = null!;
|
||||
|
||||
private Container mainContent = null!;
|
||||
public Container MainContent { get; private set; } = null!;
|
||||
|
||||
private LoadingSpinner spinner = null!;
|
||||
|
||||
@ -70,7 +71,7 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
timelineContainer = new Container
|
||||
TimelineContent = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -93,7 +94,7 @@ namespace osu.Game.Screens.Edit
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
mainContent = new Container
|
||||
MainContent = new Container
|
||||
{
|
||||
Name = "Main content",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -116,10 +117,10 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
spinner.State.Value = Visibility.Hidden;
|
||||
|
||||
mainContent.Add(content);
|
||||
MainContent.Add(content);
|
||||
content.FadeInFromZero(300, Easing.OutQuint);
|
||||
|
||||
LoadComponentAsync(new TimelineArea(CreateTimelineContent()), timelineContainer.Add);
|
||||
LoadComponentAsync(new TimelineArea(CreateTimelineContent()), TimelineContent.Add);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user