mirror of
https://github.com/ppy/osu
synced 2025-01-25 15:23:02 +00:00
Combine drag and clicky interactions
This commit is contained in:
parent
3e4cd0aeac
commit
4568af8fda
@ -47,12 +47,31 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (e.Button == MouseButton.Left)
|
||||
{
|
||||
switch (PlacementActive)
|
||||
{
|
||||
case PlacementState.Waiting:
|
||||
BeginPlacement(true);
|
||||
return true;
|
||||
|
||||
case PlacementState.Active:
|
||||
EndPlacement(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnClick(e);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (e.Button == MouseButton.Right)
|
||||
{
|
||||
EndPlacement(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnClick(e);
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e)
|
||||
@ -83,7 +102,18 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints
|
||||
if (PlacementActive != PlacementState.Active)
|
||||
gridToolboxGroup.StartPosition.Value = pos;
|
||||
else
|
||||
gridToolboxGroup.SetGridFromPoints(gridToolboxGroup.StartPosition.Value, pos);
|
||||
{
|
||||
// Default to the original spacing and rotation if the distance is too small.
|
||||
if (Vector2.Distance(gridToolboxGroup.StartPosition.Value, pos) < 2)
|
||||
{
|
||||
gridToolboxGroup.Spacing.Value = originalSpacing;
|
||||
gridToolboxGroup.GridLinesRotation.Value = originalRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
gridToolboxGroup.SetGridFromPoints(gridToolboxGroup.StartPosition.Value, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user