mirror of
https://github.com/ppy/osu
synced 2024-12-16 03:45:46 +00:00
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:
commit
5d4cfd81ec
@ -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)
|
||||
{
|
||||
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||
Hide();
|
||||
private bool closeOnMouseUp;
|
||||
|
||||
return base.OnClick(e);
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
closeOnMouseUp = !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition);
|
||||
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
private bool closeOnDragEnd;
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e)
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||
closeOnDragEnd = true;
|
||||
|
||||
return base.OnDragStart(e);
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
if (closeOnDragEnd)
|
||||
{
|
||||
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||
Hide();
|
||||
closeOnDragEnd = false;
|
||||
}
|
||||
|
||||
return base.OnDragEnd(e);
|
||||
return base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
public virtual bool OnPressed(GlobalAction action)
|
||||
|
Loading…
Reference in New Issue
Block a user