Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See https://musescore.org/en/node/289492 and https://musescore.org/en/node/289498. The first issue contains a fairly thorough description of the underlying issue: bad layout resulting from the fact that with cross-staff beams, we make an initial guess as to stem direction, do some layout based on that, then correct the stem direction guess much later after it's too late to fix the layout based on the original guess.
We've fought some version of this for years and tried to address it by improving our guess, or being smarter about trying to correct things after realizing we guessed wrong. for this PR, I took a simpler approach I think is both more likely to succeed and less likely to cause regressions elsewhere. Instead of acting on the guess, instead I recognize that all we have is a guess, so I explicitly don't act on the guess, but only on things I know won't change during the course of the layout.
In the case of slurs, we were using stem direction to layout to either the notehead or the stem dpeneding on stem direction. I've changed this so if the note is on a cross-staff beam, we always layout to the notehead.
In the case of beams, the issue was actually not so much about the beam layout as the layout of potentially overlapping chords (multiple voices on same segment), where changes of opinion about stem direction changes the horizontal offset of the chords. So, again, in cases where a chord is on a cross-staff beam, I'm changing the algorithm to note base the offset on the guessed stem direction, but on things like, was it moved to another staff, what voice is it in, etc. Some of the same things used in Chord::computeUp, but here I consider only the factors specifically relevant to cross-staff beams.
These changes should only affect cross-staff beams, so they are safe in that sense, but will no tdoubt mean some differences in layout compared to 3.0.5 and/or master without these changes. There may be cases where the guess was actually right and produced the more correct result than my new code, but with my code we should actually produce good layout either way, no weird glitches liek the ones in the issues here.
I plan to inspect the vtests before going to bed, but need to deal with a couple of other last minute regressions first.