mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Fix slider length not updating when adding new anchor via ctrl-click
This commit is contained in:
parent
f1f820bec3
commit
e8d3d26d16
@ -159,9 +159,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
if (allowSelection)
|
if (allowSelection)
|
||||||
d.RequestSelection = selectionRequested;
|
d.RequestSelection = selectionRequested;
|
||||||
|
|
||||||
d.DragStarted = dragStarted;
|
d.DragStarted = DragStarted;
|
||||||
d.DragInProgress = dragInProgress;
|
d.DragInProgress = DragInProgress;
|
||||||
d.DragEnded = dragEnded;
|
d.DragEnded = DragEnded;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Connections.Add(new PathControlPointConnectionPiece<T>(hitObject, e.NewStartingIndex + i));
|
Connections.Add(new PathControlPointConnectionPiece<T>(hitObject, e.NewStartingIndex + i));
|
||||||
@ -267,7 +267,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
private int draggedControlPointIndex;
|
private int draggedControlPointIndex;
|
||||||
private HashSet<PathControlPoint> selectedControlPoints;
|
private HashSet<PathControlPoint> selectedControlPoints;
|
||||||
|
|
||||||
private void dragStarted(PathControlPoint controlPoint)
|
public void DragStarted(PathControlPoint controlPoint)
|
||||||
{
|
{
|
||||||
dragStartPositions = hitObject.Path.ControlPoints.Select(point => point.Position).ToArray();
|
dragStartPositions = hitObject.Path.ControlPoints.Select(point => point.Position).ToArray();
|
||||||
dragPathTypes = hitObject.Path.ControlPoints.Select(point => point.Type).ToArray();
|
dragPathTypes = hitObject.Path.ControlPoints.Select(point => point.Type).ToArray();
|
||||||
@ -279,7 +279,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
changeHandler?.BeginChange();
|
changeHandler?.BeginChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dragInProgress(DragEvent e)
|
public void DragInProgress(DragEvent e)
|
||||||
{
|
{
|
||||||
Vector2[] oldControlPoints = hitObject.Path.ControlPoints.Select(cp => cp.Position).ToArray();
|
Vector2[] oldControlPoints = hitObject.Path.ControlPoints.Select(cp => cp.Position).ToArray();
|
||||||
var oldPosition = hitObject.Position;
|
var oldPosition = hitObject.Position;
|
||||||
@ -341,7 +341,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
hitObject.Path.ControlPoints[i].Type = dragPathTypes[i];
|
hitObject.Path.ControlPoints[i].Type = dragPathTypes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dragEnded() => changeHandler?.EndChange();
|
public void DragEnded() => changeHandler?.EndChange();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -39,9 +39,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
protected PathControlPointVisualiser<Slider> ControlPointVisualiser { get; private set; }
|
protected PathControlPointVisualiser<Slider> ControlPointVisualiser { get; private set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
|
||||||
private IPositionSnapProvider positionSnapProvider { get; set; }
|
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private IDistanceSnapProvider distanceSnapProvider { get; set; }
|
private IDistanceSnapProvider distanceSnapProvider { get; set; }
|
||||||
|
|
||||||
@ -191,15 +188,29 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private PathControlPoint placementControlPoint;
|
private PathControlPoint placementControlPoint;
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e) => placementControlPoint != null;
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
|
{
|
||||||
|
if (placementControlPoint == null)
|
||||||
|
return base.OnDragStart(e);
|
||||||
|
|
||||||
|
ControlPointVisualiser?.DragStarted(placementControlPoint);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
|
base.OnDrag(e);
|
||||||
|
|
||||||
if (placementControlPoint != null)
|
if (placementControlPoint != null)
|
||||||
{
|
ControlPointVisualiser?.DragInProgress(e);
|
||||||
var result = positionSnapProvider?.FindSnappedPositionAndTime(ToScreenSpace(e.MousePosition));
|
|
||||||
placementControlPoint.Position = ToLocalSpace(result?.ScreenSpacePosition ?? ToScreenSpace(e.MousePosition)) - HitObject.Position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
|
{
|
||||||
|
base.OnDragEnd(e);
|
||||||
|
|
||||||
|
if (placementControlPoint != null)
|
||||||
|
ControlPointVisualiser?.DragEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
|
Loading…
Reference in New Issue
Block a user