Skip to content

Commit

Permalink
Fix #152 - Improve the placement of slide and hammeron symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronwhite committed Oct 20, 2014
1 parent 5dcd2b3 commit 13131f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion source/painters/layoutinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ void LayoutInfo::calculateTabStaffBelowLayout()
{
int height = 1;
const int leftPosition = pos.getPosition();
const int rightPosition = leftPosition + 1;
const Position *nextPos =
VoiceUtils::getNextPosition(voice, leftPosition);
const int rightPosition =
nextPos ? nextPos->getPosition() : leftPosition + 1;
const double width = getPositionSpacing();

if (pos.hasProperty(Position::PickStrokeUp))
Expand Down
10 changes: 9 additions & 1 deletion source/painters/systemrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,15 @@ void SystemRenderer::drawSymbolsBelowTabStaff(const LayoutInfo &layout)
break;
}

const double x = layout.getPositionX(symbolGroup.getLeftPosition());
double x = layout.getPositionX(symbolGroup.getLeftPosition());
// Center symbols that apply to this note and the next adjacent note.
if (symbolGroup.getSymbolType() == SymbolGroup::Hammeron ||
symbolGroup.getSymbolType() == SymbolGroup::Pulloff ||
symbolGroup.getSymbolType() == SymbolGroup::Slide)
{
x += 0.5 * (layout.getPositionX(symbolGroup.getRightPosition()) - x);
}

centerHorizontally(*renderedSymbol, x, x + symbolGroup.getWidth());
renderedSymbol->setY(layout.getBottomTabLine() +
symbolGroup.getHeight() *
Expand Down

0 comments on commit 13131f2

Please sign in to comment.