Skip to content

Commit

Permalink
fix #289423: correct origin for note anchored lines
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed May 20, 2019
1 parent aa81f8d commit edb15d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 6 additions & 3 deletions libmscore/line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,17 +715,20 @@ QPointF SLine::linePos(Grip grip, System** sys) const
Element* e = grip == Grip::START ? startElement() : endElement();
if (!e)
return QPointF();
System* s = toNote(e)->chord()->segment()->system();
Note* n = toNote(e);
System* s = n->chord()->segment()->system();
if (s == 0) {
qDebug("no system: %s start %s chord parent %s\n", name(), e->name(), toNote(e)->chord()->parent()->name());
qDebug("no system: %s start %s chord parent %s\n", name(), n->name(), n->chord()->parent()->name());
return QPointF();
}
*sys = s;
// return the position of the anchor note relative to the system
// QPointF elemPagePos = e->pagePos(); // DEBUG
// QPointF systPagePos = s->pagePos();
// qreal staffYPage = s->staffYpage(e->staffIdx());
return e->pagePos() - s->pagePos();
QPointF p = n->pagePos() - s->pagePos();
p.rx() += n->width() * 0.5;
return p;
}

case Spanner::Anchor::CHORD:
Expand Down
16 changes: 12 additions & 4 deletions libmscore/textline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,23 @@ LineSegment* TextLine::createLineSegment()

Sid TextLineSegment::getPropertyStyle(Pid pid) const
{
if (pid == Pid::OFFSET)
return spanner()->placeAbove() ? Sid::textLinePosAbove : Sid::textLinePosBelow;
if (pid == Pid::OFFSET) {
if (spanner()->anchor() == Spanner::Anchor::NOTE)
return Sid::NOSTYLE;
else
return spanner()->placeAbove() ? Sid::textLinePosAbove : Sid::textLinePosBelow;
}
return TextLineBaseSegment::getPropertyStyle(pid);
}

Sid TextLine::getPropertyStyle(Pid pid) const
{
if (pid == Pid::OFFSET)
return placeAbove() ? Sid::textLinePosAbove : Sid::textLinePosBelow;
if (pid == Pid::OFFSET) {
if (anchor() == Spanner::Anchor::NOTE)
return Sid::NOSTYLE;
else
return placeAbove() ? Sid::textLinePosAbove : Sid::textLinePosBelow;
}
return TextLineBase::getPropertyStyle(pid);
}

Expand Down

0 comments on commit edb15d9

Please sign in to comment.