Skip to content

Comments

Fix reversing straight perfect curve sliders positioning them weirdly#36698

Merged
bdach merged 14 commits intoppy:masterfrom
64ArthurAraujo:fix-reverse-straight-perfect-curve-sliders
Feb 20, 2026
Merged

Fix reversing straight perfect curve sliders positioning them weirdly#36698
bdach merged 14 commits intoppy:masterfrom
64ArthurAraujo:fix-reverse-straight-perfect-curve-sliders

Conversation

@64ArthurAraujo
Copy link
Contributor

Closes #35919

To find the right position for the middle control point the code currently retrieves the slider's path to the end, saves it at circleArcPath and uses the middle index with circleArcPath.Count / 2 to reposition the middle control point.

If the slider is perfectly straight aligned its circleArcPath can look like:

0 (0,0)
1 (0,0)
2 (-107.337265, -47.14827)
3 (-107.337265, -47.14827)

or

0 (0,0)
1 (0,0)
2 (-0.00012207031, 0)
3 (-107.337265, -47.14827)
4 (-107.337265, -47.14827)

In example 1 the picked index is the end of the slider
In example 2 the picked index is the start of the slider

This PR adds a check to see if there are more than two unique values in the circleArcPath, rounding the coordinates to deal with a possible float number.

If we have more than two the behavior is kept unchanged, if we don't have more than 2 unique coordinates the slider does not have an arc and we can use the last control point's coordinates divided by 2 to find the middle of the slider.

before.mp4
after.mp4

@bdach
Copy link
Collaborator

bdach commented Feb 19, 2026

I don't get it.

In #35919 (comment) you've pointed out that I was wrong about the current solution "preserving relative placement of the anchors". So I'd rather take the simple solution you had in #35919 (comment) over this.

Just maybe check that the slider length adjustment feature doesn't break with your solution.

@64ArthurAraujo
Copy link
Contributor Author

I think i got things a little bit confused here my bad, anyways good thing we can go with the simplest solution.

Just maybe check that the slider length adjustment feature doesn't break with your solution.

If by check you mean a test case i don't think this will be necessary, SliderPath.PositionAt gets the position in the path, using Distance which is always the same no matter how long the user may extend the slider or how many repeats the slider may have.

@bdach
Copy link
Collaborator

bdach commented Feb 19, 2026

I mean I'm not 100% certain that your assumption that Path.GetPosition(0.5) always gets you the midpoint of the slider is correct. Slider paths support arbitrary shortening via the semi-ring-shaped handle at the end of the slider. You should check that that still works correctly.

Or actually I'm not even sure this will work correctly for multi-segment sliders even.

@64ArthurAraujo
Copy link
Contributor Author

64ArthurAraujo commented Feb 19, 2026

Ohh i see what you mean, i thought you were talking about the timeline lenght adjust, i never noticed that this ring at the end of the slider reduced its size, it indeed needs a test then.

As you predicted it did break multi segmented sliders. Maybe we can keep the current behaviour for multi-segmented sliders and apply the positionAt(0.5) fix only if controlPoints.Count == 3 && controlPoints[^3].Type == PathType.PERFECT_CURVE && controlPoints[^2].Type == null ?

Screencast.From.2026-02-19.09-29-09.mp4

@bdach
Copy link
Collaborator

bdach commented Feb 19, 2026

You can use part of the previous code. It was fetching lastSegmentStart and lastSegmentEnd. Maybe your solution still works if you bring that back and instead pass (lastSegmentStart + lastSegmentEnd) / 2 to the PositionAt() invocation.

Add checks to see if reducing sliders with SliderEndDragMarker does not break anything
…'s middle

Uses lastSegmentStart lastSegmentEnd to determine the middle of the slider instead of assuming it is sliderPath.positionAt(0.5)
@bdach bdach merged commit c144cf1 into ppy:master Feb 20, 2026
7 of 9 checks passed
@64ArthurAraujo 64ArthurAraujo deleted the fix-reverse-straight-perfect-curve-sliders branch February 21, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reversing perfect curve sliders (Ctrl+G) with 3 nodes that are close to flat produces very unexpected results

2 participants