Skip to content

Commit

Permalink
Merge pull request #5056 from MarcSabatella/289548-articulation-direc…
Browse files Browse the repository at this point in the history
…tion

fix #289548: incorrect initial layout of added articulations
  • Loading branch information
anatoly-os committed May 23, 2019
1 parent 19eb5bb commit 8b1a7dc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libmscore/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1963,8 +1963,10 @@ void Chord::layoutPitched()
}
}

#if 0
if (!_articulations.isEmpty()) {
// TODO: allocate space to avoid "staircase" effect
// but we would need to determine direction in order to get correct symid & bbox
// another alternative is to limit the width contribution of the articulation in layoutArticulations2()
//qreal aWidth = 0.0;
for (Articulation* a : articulations())
Expand All @@ -1974,6 +1976,7 @@ void Chord::layoutPitched()
//lll = qMax(lll, aExtra);
//rrr = qMax(rrr, aExtra);
}
#endif

_spaceLw = lll;
_spaceRw = rrr;
Expand Down Expand Up @@ -2321,11 +2324,13 @@ void Chord::layoutTablature()
rrr = qMax(rrr, x);
}

#if 0
if (!_articulations.isEmpty()) {
// TODO: allocate space? see layoutPitched()
for (Articulation* a : articulations())
a->layout();
}
#endif

_spaceLw = lll;
_spaceRw = rrr;
Expand Down Expand Up @@ -3278,6 +3283,7 @@ void Chord::layoutArticulations()
continue;

bool bottom = !a->up(); // true: articulation is below chord; false: articulation is above chord
a->layout(); // must be done after assigning direction, or else symId is not reliable

bool headSide = bottom == up();
qreal x = centerX();
Expand Down Expand Up @@ -3401,13 +3407,15 @@ void Chord::layoutArticulations2()

if (a->up()) {
if (!a->layoutCloseToNote()) {
a->layout();
a->setPos(x, chordTopY);
a->doAutoplace();
}
chordTopY = a->y() - a->height() - 0.5 * _spatium;
}
else {
if (!a->layoutCloseToNote()) {
a->layout();
a->setPos(x, chordBotY);
a->doAutoplace();
}
Expand All @@ -3423,6 +3431,7 @@ void Chord::layoutArticulations2()
for (Articulation* a : _articulations) {
ArticulationAnchor aa = a->anchor();
if (aa == ArticulationAnchor::TOP_STAFF || aa == ArticulationAnchor::BOTTOM_STAFF) {
a->layout();
if (a->up()) {
a->setPos(x, staffTopY);
staffTopY -= distance0;
Expand Down

0 comments on commit 8b1a7dc

Please sign in to comment.