mirror of
https://github.com/ppy/osu
synced 2024-12-13 18:37:04 +00:00
b325f0ee0b
Until now, toolbox scroll areas would block input from arriving behind them, even when no visible element was clicked. In addition, clicking on a button inside a toolbox would still send a `MouseDown` event to things behind it. Specifically, the editor's `HitObjectComposer` would receive these events and also place objects when the user does not expect them to be placed. This fixes another regression that occurred due to `ScrollContainer`s no longer blocking input theirselves.
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Linq;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Input.Events;
|
|
using osu.Game.Graphics.Containers;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Rulesets.Edit
|
|
{
|
|
public class ExpandingToolboxContainer : ExpandingContainer
|
|
{
|
|
protected override double HoverExpansionDelay => 250;
|
|
|
|
public ExpandingToolboxContainer(float contractedWidth, float expandedWidth)
|
|
: base(contractedWidth, expandedWidth)
|
|
{
|
|
RelativeSizeAxes = Axes.Y;
|
|
|
|
FillFlow.Spacing = new Vector2(10);
|
|
}
|
|
|
|
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && anyToolboxHovered(screenSpacePos);
|
|
|
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) && anyToolboxHovered(screenSpacePos);
|
|
|
|
private bool anyToolboxHovered(Vector2 screenSpacePos) => FillFlow.Children.Any(d => d.ScreenSpaceDrawQuad.Contains(screenSpacePos));
|
|
|
|
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
|
|
|
protected override bool OnClick(ClickEvent e) => true;
|
|
}
|
|
}
|