Skip to content

Commit

Permalink
fix #30626: Tablature stems too long
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Dec 18, 2014
1 parent 94d629d commit 07f7cc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions libmscore/beam.cpp
Expand Up @@ -292,7 +292,7 @@ void Beam::layout1()
}
}
}
foreach(ChordRest* cr, _elements)
for (ChordRest* cr : _elements)
cr->setUp(_up);
}
else {
Expand Down Expand Up @@ -357,11 +357,11 @@ void Beam::layout1()
}


_cross = minMove < maxMove;
_cross = minMove < maxMove;
// int idx = (_direction == MScore::Direction::AUTO || _direction == MScore::Direction::DOWN) ? 0 : 1;
slope = 0.0;
slope = 0.0;

foreach(ChordRest* cr, _elements)
for (ChordRest* cr : _elements)
cr->setUp(_up);

} // end of if/else(tablature)
Expand Down Expand Up @@ -1027,14 +1027,15 @@ static int adjust(qreal _spatium4, int slant, const QList<ChordRest*>& cl)
int n = cl.size();
const ChordRest* c1 = cl[0];
const ChordRest* c2 = cl[n-1];
if (c1->staff() && c1->staff()->isTabStaff())
return 0;

QPointF p1(c1->stemPosBeam()); // canvas coordinates
qreal slope = (slant * _spatium4) / (c2->stemPosBeam().x() - p1.x());
int ml = -1000;
if (c1->up()) {
for (int i = 1; i < n; ++i) {
const ChordRest* c = cl[i];
QPointF p3(c->stemPosBeam());
QPointF p3(cl[i]->stemPosBeam());
qreal yUp = p1.y() + (p3.x() - p1.x()) * slope;
int l = lrint((yUp - p3.y()) / (_spatium4));
ml = qMax(ml, l);
Expand Down Expand Up @@ -1396,7 +1397,6 @@ void Beam::computeStemLen(const QList<ChordRest*>& cl, qreal& py1, int beamLevel
else
bm.l += graceStemLengthCorrection;
}

if (dx == 0.0)
slope = 0.0;
else
Expand Down
4 changes: 2 additions & 2 deletions libmscore/chord.cpp
Expand Up @@ -388,9 +388,9 @@ QPointF Chord::stemPos() const
QPointF Chord::stemPosBeam() const
{
qreal _spatium = spatium();
if (staff() && staff()->isTabStaff())
return staff()->staffType()->chordStemPosBeam(this) * _spatium + pagePos();
QPointF p(pagePos());
if (staff() && staff()->isTabStaff())
return staff()->staffType()->chordStemPosBeam(this) * _spatium + p;
if (_up) {
qreal nhw = score()->noteHeadWidth();
if (_noteType != NoteType::NORMAL)
Expand Down

0 comments on commit 07f7cc6

Please sign in to comment.