Skip to content

Commit

Permalink
fix #268147 Bad horizontal alignment of pedal lines
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 12, 2018
1 parent 902ae54 commit acc7757
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2846,7 +2846,7 @@ static void layoutTies(Chord* ch, System* system, int stick)
// processLines
//---------------------------------------------------------

static void processLines(System* system, std::vector<Spanner*> lines)
static void processLines(System* system, std::vector<Spanner*> lines, bool align)
{
std::vector<SpannerSegment*> segments;
for (Spanner* sp : lines) {
Expand All @@ -2855,6 +2855,14 @@ static void processLines(System* system, std::vector<Spanner*> lines)
segments.push_back(ss);
}

if (align && segments.size() > 1) {
qreal y = segments[0]->userOff().y();
for (unsigned i = 1; i < segments.size(); ++i)
y = qMax(y, segments[i]->userOff().y());
for (auto ss : segments)
ss->rUserYoffset() = y;
}

//
// add shapes to staff shapes
//
Expand Down Expand Up @@ -3163,7 +3171,7 @@ System* Score::collectSystem(LayoutContext& lc)
spanner.push_back(sp);
}
}
processLines(system, spanner);
processLines(system, spanner, false);
}

std::vector<Dynamic*> dynamics;
Expand Down Expand Up @@ -3246,19 +3254,23 @@ System* Score::collectSystem(LayoutContext& lc)

std::vector<Spanner*> ottavas;
std::vector<Spanner*> spanner;
std::vector<Spanner*> pedal;

for (auto interval : spanners) {
Spanner* sp = interval.value;
if (sp->tick() < etick && sp->tick2() > stick) {
if (sp->isOttava())
ottavas.push_back(sp);
else if (sp->isPedal())
pedal.push_back(sp);
else if (!sp->isSlur()) // slurs are already handled
spanner.push_back(sp);
}
}

processLines(system, ottavas);
processLines(system, spanner);
processLines(system, ottavas, false);
processLines(system, pedal, true);
processLines(system, spanner, false);

//
// vertical align volta segments
Expand Down

0 comments on commit acc7757

Please sign in to comment.