Fix slider creation regressing with path selection changes

This commit is contained in:
Dean Herbert 2019-11-03 19:59:37 +09:00
parent 1155aacd90
commit bcf8a6d514
4 changed files with 21 additions and 10 deletions

View File

@ -128,19 +128,24 @@ private void updateConnectingPath()
protected override bool OnMouseDown(MouseDownEvent e)
{
isClicked = true;
return true;
return false;
}
protected override bool OnMouseUp(MouseUpEvent e)
{
isClicked = false;
return true;
return false;
}
protected override bool OnClick(ClickEvent e)
{
RequestSelection?.Invoke(Index);
return true;
if (RequestSelection != null)
{
RequestSelection.Invoke(Index);
return true;
}
return false;
}
protected override bool OnDragStart(DragStartEvent e) => true;

View File

@ -17,12 +17,14 @@ public class PathControlPointVisualiser : CompositeDrawable
internal readonly Container<PathControlPointPiece> Pieces;
private readonly Slider slider;
private readonly bool allowSelection;
private InputManager inputManager;
public PathControlPointVisualiser(Slider slider)
public PathControlPointVisualiser(Slider slider, bool allowSelection)
{
this.slider = slider;
this.allowSelection = allowSelection;
RelativeSizeAxes = Axes.Both;
@ -42,11 +44,15 @@ protected override void Update()
while (slider.Path.ControlPoints.Length > Pieces.Count)
{
Pieces.Add(new PathControlPointPiece(slider, Pieces.Count)
var piece = new PathControlPointPiece(slider, Pieces.Count)
{
ControlPointsChanged = c => ControlPointsChanged?.Invoke(c),
RequestSelection = selectPiece
});
};
if (allowSelection)
piece.RequestSelection = selectPiece;
Pieces.Add(piece);
}
while (slider.Path.ControlPoints.Length < Pieces.Count)

View File

@ -51,7 +51,7 @@ private void load(OsuColour colours)
bodyPiece = new SliderBodyPiece(),
headCirclePiece = new HitCirclePiece(),
tailCirclePiece = new HitCirclePiece(),
new PathControlPointVisualiser(HitObject) { ControlPointsChanged = _ => updateSlider() },
new PathControlPointVisualiser(HitObject, false) { ControlPointsChanged = _ => updateSlider() },
};
setState(PlacementState.Initial);

View File

@ -33,7 +33,7 @@ public SliderSelectionBlueprint(DrawableSlider slider)
BodyPiece = new SliderBodyPiece(),
HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
ControlPointVisualiser = new PathControlPointVisualiser(sliderObject) { ControlPointsChanged = onNewControlPoints },
ControlPointVisualiser = new PathControlPointVisualiser(sliderObject, true) { ControlPointsChanged = onNewControlPoints },
};
}