Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show whether drawable is receiving input in draw visualiser #6481

Merged
merged 1 commit into from
Jan 2, 2025
Merged
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
38 changes: 36 additions & 2 deletions osu.Framework/Graphics/Visualisation/VisualisedDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
using osuTK.Input;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;

Expand Down Expand Up @@ -76,6 +78,8 @@ public bool MatchingFilter
private Drawable activityInvalidate;
private Drawable activityAutosize;
private Drawable activityLayout;
private Drawable inputReceiving;

private VisualisedDrawableFlow flow;
private Container connectionContainer;

Expand Down Expand Up @@ -123,6 +127,30 @@ private void load()
Origin = Anchor.Centre,
Colour = Color4.Transparent,
},
inputReceiving = new Container
{
Size = new Vector2(5, line_height),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Position = new Vector2(9, 0),
Alpha = 0,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Cyan,
RelativeSizeAxes = Axes.Both,
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.Cyan.Darken(5),
Icon = FontAwesome.Solid.MousePointer,
Size = new Vector2(6),
}
}
},
activityInvalidate = new Box
{
Colour = Color4.Yellow,
Expand Down Expand Up @@ -170,7 +198,7 @@ private void load()
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5),
Position = new Vector2(24, 0),
Position = new Vector2(30, 0),
Children = new Drawable[]
{
text = new SpriteText { Font = FrameworkFont.Regular },
Expand Down Expand Up @@ -206,7 +234,7 @@ private void load()
}
});

previewBox.Position = new Vector2(9, 0);
previewBox.Position = new Vector2(15, 0);
previewBox.Size = new Vector2(line_height, line_height);

var compositeTarget = Target as CompositeDrawable;
Expand Down Expand Up @@ -419,6 +447,12 @@ private void updateSpecifics()
{
Vector2 posInTree = ToSpaceOfOtherDrawable(Vector2.Zero, tree);

inputReceiving.Alpha =
Target.GetContainingInputManager() is InputManager inputManager &&
Target.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position)
? 1
: 0;

if (posInTree.Y < -previewBox.DrawHeight || posInTree.Y > tree.Height)
{
text.Text = string.Empty;
Expand Down
Loading