Merge pull request #7034 from Joehuu/fix-overlays-drag-closing

Fix overlays closing when dragging from in/out or out/in
This commit is contained in:
Dan Balasescu 2019-12-02 14:31:05 +09:00 committed by GitHub
commit 5d4cfd81ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,33 +67,21 @@ namespace osu.Game.Graphics.Containers
// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos);
protected override bool OnClick(ClickEvent e)
private bool closeOnMouseUp;
protected override bool OnMouseDown(MouseDownEvent e)
{
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
closeOnMouseUp = !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition);
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
{
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
Hide();
return base.OnClick(e);
}
private bool closeOnDragEnd;
protected override bool OnDragStart(DragStartEvent e)
{
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
closeOnDragEnd = true;
return base.OnDragStart(e);
}
protected override bool OnDragEnd(DragEndEvent e)
{
if (closeOnDragEnd)
{
Hide();
closeOnDragEnd = false;
}
return base.OnDragEnd(e);
return base.OnMouseUp(e);
}
public virtual bool OnPressed(GlobalAction action)