mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 13:22:55 +08:00
Bind StackHeight
changes to visual update methods
This commit is contained in:
parent
93f1578c10
commit
450e7016bc
@ -172,6 +172,54 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
assertControlPointPathType(4, null);
|
assertControlPointPathType(4, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestStackingUpdatesPointsPosition()
|
||||||
|
{
|
||||||
|
createVisualiser(true);
|
||||||
|
|
||||||
|
Vector2[] points = [
|
||||||
|
new Vector2(200),
|
||||||
|
new Vector2(300),
|
||||||
|
new Vector2(500, 300),
|
||||||
|
new Vector2(700, 200),
|
||||||
|
new Vector2(500, 100)
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach (var point in points) addControlPointStep(point);
|
||||||
|
|
||||||
|
AddStep("apply stacking", () => slider.StackHeightBindable.Value += 1);
|
||||||
|
|
||||||
|
for (int i = 0; i < points.Length; i++)
|
||||||
|
addAssertPointPositionChanged(points, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestStackingUpdatesConnectionPosition()
|
||||||
|
{
|
||||||
|
createVisualiser(true);
|
||||||
|
|
||||||
|
Vector2 connectionPosition = default!;
|
||||||
|
|
||||||
|
addControlPointStep(connectionPosition = new Vector2(300));
|
||||||
|
addControlPointStep(new Vector2(600));
|
||||||
|
|
||||||
|
// Apply a big number in stacking so the person running the test can clearly see if it fails
|
||||||
|
AddStep("apply stacking", () => slider.StackHeightBindable.Value += 10);
|
||||||
|
|
||||||
|
AddAssert($"Connection at {connectionPosition} changed",
|
||||||
|
() => visualiser.Connections[0].Position,
|
||||||
|
() => !Is.EqualTo(connectionPosition)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAssertPointPositionChanged(Vector2[] points, int index)
|
||||||
|
{
|
||||||
|
AddAssert($"Point at {points.ElementAt(index)} changed",
|
||||||
|
() => visualiser.Pieces[index].Position,
|
||||||
|
() => !Is.EqualTo(points.ElementAt(index))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private void createVisualiser(bool allowSelection) => AddStep("create visualiser", () => Child = visualiser = new PathControlPointVisualiser<Slider>(slider, allowSelection)
|
private void createVisualiser(bool allowSelection) => AddStep("create visualiser", () => Child = visualiser = new PathControlPointVisualiser<Slider>(slider, allowSelection)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -56,6 +56,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
pathVersion = hitObject.Path.Version.GetBoundCopy();
|
pathVersion = hitObject.Path.Version.GetBoundCopy();
|
||||||
pathVersion.BindValueChanged(_ => Scheduler.AddOnce(updateConnectingPath));
|
pathVersion.BindValueChanged(_ => Scheduler.AddOnce(updateConnectingPath));
|
||||||
|
|
||||||
|
hitObject.StackHeightBindable.BindValueChanged(_ => updateConnectingPath());
|
||||||
|
|
||||||
updateConnectingPath();
|
updateConnectingPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +105,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
hitObjectScale = hitObject.ScaleBindable.GetBoundCopy();
|
hitObjectScale = hitObject.ScaleBindable.GetBoundCopy();
|
||||||
hitObjectScale.BindValueChanged(_ => updateMarkerDisplay());
|
hitObjectScale.BindValueChanged(_ => updateMarkerDisplay());
|
||||||
|
|
||||||
|
hitObject.StackHeightBindable.BindValueChanged(_ => updateMarkerDisplay());
|
||||||
|
|
||||||
IsSelected.BindValueChanged(_ => updateMarkerDisplay());
|
IsSelected.BindValueChanged(_ => updateMarkerDisplay());
|
||||||
|
|
||||||
updateMarkerDisplay();
|
updateMarkerDisplay();
|
||||||
|
Loading…
Reference in New Issue
Block a user