Skip to content

Commit

Permalink
fix #26546
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jul 31, 2014
1 parent b81fee5 commit 6d2225b
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions libmscore/line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,24 +441,28 @@ SLine::SLine(const SLine& s)

QPointF SLine::linePos(GripLine grip, System** sys)
{
qreal _spatium = spatium();
qreal x = 0.0;
switch (anchor()) {
case Spanner::Anchor::SEGMENT:
{
Measure* m;
int t;
ChordRest* cr;
if (grip == GripLine::START)
t = tick();
cr = static_cast<ChordRest*>(startElement());
else {
cr = static_cast<ChordRest*>(endElement());
if (cr)
x += cr->width();
}

int t = grip == GripLine::START ? tick() : tick2();
Measure* m = cr ? cr->measure() : score()->tick2measure(t);

if (m) {
x += cr ? cr->pos().x() + cr->segment()->pos().x() + m->pos().x() : m->tick2pos(t);
*sys = m->system();
}
else
t = tick2() - 1;
m = score()->tick2measure(t);
if (!m) {
*sys = 0;
break;
}
x += m->tick2pos(t);
*sys = m->system();
}
break;

Expand All @@ -475,6 +479,8 @@ QPointF SLine::linePos(GripLine grip, System** sys)
}
}
else {
qreal _spatium = spatium();

Q_ASSERT(endElement()->type() == Element::Type::MEASURE);
m = static_cast<Measure*>(endElement());
x = m->pos().x() + m->bbox().right();
Expand Down

0 comments on commit 6d2225b

Please sign in to comment.