-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cross staff tie layout #21192
Fix cross staff tie layout #21192
Conversation
3863949
to
6afac52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
|
||
return (startN && startN->chord()->staffMove() != 0) || (endN && endN->chord()->staffMove() != 0); | ||
return (startChord && (startChord->staffMove() != 0 || startChord->vStaffIdx() != staff)) | ||
|| (endChord && (endChord->staffMove() != 0 || endChord->vStaffIdx() != staff)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why we need to add the chord->vstaffIdx() != staff
condition? At a first glance it looks redundant to me, cause it can only be true if at least one chord has staffMove() != 0
. Or is there a case that I'm not thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed when the tie starts on a note on staff 0 (the tie's staff is 0) and ends on a note on staff 1. In this case neither chord is currently moved but the tie should still be cross staff. (eg. the first case in the attached screenshot)
@@ -1556,6 +1558,10 @@ TieSegment* SlurTieLayout::tieLayoutBack(Tie* item, System* system, LayoutContex | |||
segment->setSystem(system); | |||
segment->resetAdjustmentOffset(); | |||
|
|||
if (chord) { | |||
segment->setStaffIdx(chord->vStaffIdx()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels slightly hacky (and slightly dangerous) cause you are changing the staffIdx of only one of the TieSegments, so you end up with mismatching tracks between the Tie item and its two TieSegments. Anyway, this is such an edge case that, if it works properly, I think we can keep the hack, for once, as it does make it all quite simple. Maybe do write a small hack-warning comment to explain that though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, having a vStaffIdx
field for tie segments would absolutely be safer - I can try to make that work
6afac52
to
ecc953f
Compare
Resolves: #20747
Fix layout of cross staff ties on the same system and between systems.
![Screenshot 2024-01-24 at 17 42 24](https://private-user-images.githubusercontent.com/26510874/299407791-f4ba1214-cd6d-44a0-b3ff-71fab1f8bf70.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzODcyMzQsIm5iZiI6MTcyNDM4NjkzNCwicGF0aCI6Ii8yNjUxMDg3NC8yOTk0MDc3OTEtZjRiYTEyMTQtY2Q2ZC00NGEwLWIzZmYtNzFmYWIxZjhiZjcwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA0MjIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRkOTFkMWY5M2IyMzE4ZTM0ZWFjNjFiZGQyOWI0YmMyY2Y4NGEzZTU4OThlYjJhOGFhMDc5YzdhMmRkZGJmMTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.gTw58p70Wd0MwaQFFf4QNI-LzRkNviv1L2aZdauWsNc)