Skip to content

Commit

Permalink
Merge pull request #2694 from nyquillerium/blocking-parent
Browse files Browse the repository at this point in the history
Expose CompositeDrawable's subtree specific positional input conditional
  • Loading branch information
peppy authored Jul 26, 2019
2 parents 25f3763 + b21a026 commit a998d8c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion osu.Framework/Graphics/Containers/CompositeDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,12 +1221,23 @@ internal override bool BuildNonPositionalInputQueue(List<Drawable> queue, bool a
return true;
}

/// <summary>
/// Determines whether the subtree of this <see cref="CompositeDrawable"/> should receive positional input when the mouse is at the given screen-space position.
/// </summary>
/// <remarks>
/// By default, the subtree of this <see cref="CompositeDrawable"/> always receives input when masking is turned off, and only receives input if this
/// <see cref="CompositeDrawable"/> also receives input when masking is turned on.
/// </remarks>
/// <param name="screenSpacePos">The screen-space position where input could be received.</param>
/// <returns>True if the subtree should receive input at the given screen-space position.</returns>
protected virtual bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => !Masking || ReceivePositionalInputAt(screenSpacePos);

internal override bool BuildPositionalInputQueue(Vector2 screenSpacePos, List<Drawable> queue)
{
if (!base.BuildPositionalInputQueue(screenSpacePos, queue))
return false;

if (Masking && !ReceivePositionalInputAt(screenSpacePos))
if (!ReceivePositionalInputAtSubTree(screenSpacePos))
return false;

for (int i = 0; i < aliveInternalChildren.Count; ++i)
Expand Down

0 comments on commit a998d8c

Please sign in to comment.