-
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
Smarter gliss positioning around chord shapes #19403
Conversation
ba7c635
to
5bfddb3
Compare
// don't consider symbols above and below noteheads | ||
double yMin = cr1->upNote()->y() + cr1->upNote()->headHeight(); | ||
double yMax = cr1->downNote()->y(); | ||
mu::remove_if(cr1shape, [yMin, yMax](ShapeElement& s) { |
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.
mu::remove_if(cr1shape, [yMin, yMax](ShapeElement& s) { | |
mu::remove_if(cr1shape, [yMin, yMax](const ShapeElement& s) { |
Shape cr2shape = cr2->shape(); | ||
double yMin2 = cr2->upNote()->y() + cr2->upNote()->headHeight(); | ||
double yMax2 = cr2->downNote()->y(); | ||
mu::remove_if(cr2shape, [yMin2, yMax2](ShapeElement& s) { | ||
if (!s.toItem || (s.toItem->isSymbol() && (s.toItem->y() < yMin2 || s.toItem->y() > yMax2))) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}); |
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.
There is some code duplication here... perhaps it would be preferable to create a local lambda function and call that twice. I.e.
auto relevantShape(const Chord* cr) -> Shape {
Shape s = cr->shape();
double yMin = …; double yMax = …; …
mu::remove_if(…);
return s;
}
…
offs1.rx() += relevantShape(cr1).right() - anchor1->pos().x();
Actually it looks like it would be possible to use Michele's new |
Probably also helps for #19456 (at least when using |
A rebase is needed |
5bfddb3
to
2b476cb
Compare
if (upDown != 0) { | ||
// Only check top/bottom half of note depending on gliss approach direction | ||
// to avoid clearing acidentals the line won't collide with | ||
yAbove2 = upDown == 1 ? noteMiddle - 1 : yAbove2; |
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.
Is it intentional that there is an "absolute" - 1
here? Shouldn't it be relative to spatium or line distance? (Or is it that already and am I missing that?)
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.
Apologies - this was to make sure the ledger line was included in the left most edge check. I've replaced it with the thickness of the ledger line
2b476cb
to
cd281a2
Compare
Resolves: #17955
Resolves: #19456
Calculates the edge of chords at start/end of gliss using
right/leftMostEdgeAtHeight
allowing the lines to better avoid parts of the chord shape.