Skip to content

Commit

Permalink
Fix #34391 - Augm. dots collide with hooks beside staff
Browse files Browse the repository at this point in the history
  • Loading branch information
mgavioli committed Feb 25, 2015
1 parent e4fcb01 commit 4b02f3c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
29 changes: 21 additions & 8 deletions libmscore/chord.cpp
Expand Up @@ -2188,14 +2188,6 @@ void Chord::layoutTablature()
// special case of system-initial glissando final note is handled in Glissando::layout() itself
}

if (dots()) {
qreal x = dotPosX() + dotNoteDistance
+ (dots()-1) * score()->styleS(StyleIdx::dotDotDistance).val() * _spatium;
x += symWidth(SymId::augmentationDot);
if (x > rrr)
rrr = x;
}

if (_hook) {
if (beam())
score()->undoRemoveElement(_hook);
Expand All @@ -2209,6 +2201,27 @@ void Chord::layoutTablature()
}
}

if (dots()) {
qreal x = 0.0;
// if stems are beside staff, dots are placed near to stem
if (!tab->stemThrough()) {
// if there is an unbeamed hook, dots should start after the hook
if (_hook && !beam())
x = _hook->width() + dotNoteDistance;
// if not, dots should start at a fixed distance right after the stem
else
x = STAFFTYPE_TAB_DEFAULTDOTDIST_X * _spatium;
if (segment())
segment()->setDotPosX(staffIdx(), x);
}
// if stems are through staff, use dot position computed above on fret mark widths
else
x = dotPosX() + dotNoteDistance
+ (dots()-1) * score()->styleS(StyleIdx::dotDotDistance).val() * _spatium;
x += symWidth(SymId::augmentationDot);
rrr = qMax(rrr, x);
}

_space.setLw(lll);
_space.setRw(rrr);

Expand Down
7 changes: 5 additions & 2 deletions libmscore/stem.cpp
Expand Up @@ -191,8 +191,11 @@ void Stem::draw(QPainter* painter) const
// with tablatures and stems beside staves, dots are not drawn near 'notes', but near stems
int nDots = chord()->dots();
if (nDots > 0 && !stt->stemThrough()) {
qreal y = ( (STAFFTYPE_TAB_DEFAULTSTEMLEN_DN * 0.2) * sp) * (_up ? -1.0 : 1.0);
drawSymbol(SymId::augmentationDot, painter, QPointF(STAFFTYPE_TAB_DEFAULTDOTDIST_X * sp, y), nDots);
qreal x = chord()->dotPosX();
qreal y = ( (STAFFTYPE_TAB_DEFAULTSTEMLEN_DN * 0.2) * sp) * (_up ? -1.0 : 1.0);
qreal step = score()->styleS(StyleIdx::dotDotDistance).val() * sp;
for (int dot = 0; dot < nDots; dot++, x += step)
drawSymbol(SymId::augmentationDot, painter, QPointF(x, y));
}
}

Expand Down

0 comments on commit 4b02f3c

Please sign in to comment.