Skip to content

Commit

Permalink
Fix #19923: TAB digits not centered on stem
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurizio M. Gavioli committed Feb 4, 2013
1 parent 8480e32 commit 9738d8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion libmscore/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,9 @@ void Chord::layout()
for (int i = 0; i < n; ++i) {
Note* note = _notes.at(i);
note->layout();
note->setPos(0.0, _spatium * tab->physStringToVisual(note->string()) * lineDist);
// centre fret string on stem
qreal x = tab->chordStemPosX(this) * _spatium - note->bbox().width()*0.5;
note->setPos(x, _spatium * tab->physStringToVisual(note->string()) * lineDist);
note->layout2();
}
// if tab type is stemless or duration longer than half (if halves have stems) or duration longer than crochet
Expand Down
4 changes: 1 addition & 3 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,9 +1254,7 @@ void Note::layout()
StaffTypeTablature* tab = (StaffTypeTablature*)staff()->staffType();
qreal mags = magS();
qreal w = tabHeadWidth(tab);
// centre fret string to note head
qreal xo = (headWidth() - w) * .5;
bbox().setRect(xo, tab->fretBoxY() * mags, w, tab->fretBoxH() * mags);
bbox().setRect(0.0, tab->fretBoxY() * mags, w, tab->fretBoxH() * mags);
}
else {
setbbox(symbols[score()->symIdx()][noteHead()].bbox(magS()));
Expand Down
1 change: 1 addition & 0 deletions libmscore/stafftype.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ class StaffTypeTablature : public StaffType {

// utility functions for tab specially managed elements
QPointF chordStemPos(const Chord * chord) const;
qreal chordStemPosX(const Chord * /*chord*/) const { return STAFFTYPE_TAB_DEFAULTSTEMPOSX; }
QPointF chordStemPosBeam(const Chord * chord) const;
qreal chordStemLength(const Chord *chord) const;

Expand Down

0 comments on commit 9738d8a

Please sign in to comment.