mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 18:02:56 +08:00
Fix double-click incorrectly firing across disparate targets
This commit is contained in:
parent
e651a87d1d
commit
222a22182e
@ -121,14 +121,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return e.Button == MouseButton.Left;
|
return e.Button == MouseButton.Left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SelectionBlueprint clickedBlueprint;
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButton.Right)
|
if (e.Button == MouseButton.Right)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// store for double-click handling
|
||||||
|
clickedBlueprint = selectionHandler.SelectedBlueprints.FirstOrDefault(b => b.IsHovered);
|
||||||
|
|
||||||
// Deselection should only occur if no selected blueprints are hovered
|
// Deselection should only occur if no selected blueprints are hovered
|
||||||
// A special case for when a blueprint was selected via this click is added since OnClick() may occur outside the hitobject and should not trigger deselection
|
// A special case for when a blueprint was selected via this click is added since OnClick() may occur outside the hitobject and should not trigger deselection
|
||||||
if (endClickSelection() || selectionHandler.SelectedBlueprints.Any(b => b.IsHovered))
|
if (endClickSelection() || clickedBlueprint != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
deselectAll();
|
deselectAll();
|
||||||
@ -140,9 +145,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (e.Button == MouseButton.Right)
|
if (e.Button == MouseButton.Right)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SelectionBlueprint clickedBlueprint = selectionHandler.SelectedBlueprints.FirstOrDefault(b => b.IsHovered);
|
// ensure the blueprint which was hovered for the first click is still the hovered blueprint.
|
||||||
|
if (clickedBlueprint == null || selectionHandler.SelectedBlueprints.FirstOrDefault(b => b.IsHovered) != clickedBlueprint)
|
||||||
if (clickedBlueprint == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
editorClock?.SeekTo(clickedBlueprint.HitObject.StartTime);
|
editorClock?.SeekTo(clickedBlueprint.HitObject.StartTime);
|
||||||
|
Loading…
Reference in New Issue
Block a user