Skip to content
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

Correct measure width when following begins with clef, key or time sig #26806

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

miiizen
Copy link
Contributor

@miiizen miiizen commented Feb 27, 2025

Resolves: #26780

In this situation, the first segment of the measure is a key signature.
We should set the width of the preceding chordrest segment by using the difference between the next segment position and this segment's position. Otherwise, the start of the measure is placed well before the position of it's first segment, the key signature.
This case was already handled for start repeat barlines, I have just extended it to cover clefs, key and time signatures.

double segWidth = curSegMeasure == nextSegMeasure || nextSeg->isStartRepeatBarLineType() ? nextX - curX : curSeg->minRight();
double segWidth = curSegMeasure == nextSegMeasure || nextSeg->isStartRepeatBarLineType()
|| nextSeg->isKeySigType() || nextSeg->isTimeSigType()
|| nextSeg->isClefType() ? nextX - curX : curSeg->minRight();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unreadable now though. Perhaps a bool computeWidthByDifferenceFromNext or something like that could help

@oktophonie oktophonie added the vtests This PR produces approved changes to vtest results label Feb 28, 2025
Copy link
Contributor

@mike-spa mike-spa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, thank you :)

@mike-spa mike-spa merged commit f3b163d into musescore:master Feb 28, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vtests This PR produces approved changes to vtest results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too much space before key signature preceding a start repeat
3 participants