Skip to content

Commit

Permalink
Fix computation of smallness for tuplets
Browse files Browse the repository at this point in the history
Tuplets will now be small if all containing elements are either 1) small chordrests or 2) tuplets with all small chordrests or tuplets
  • Loading branch information
asattely committed Nov 23, 2021
1 parent 7f00fe8 commit 660c8ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/engraving/libmscore/tuplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ void Tuplet::layout()
_number->setXmlText(QString("%1:%2").arg(_ratio.numerator()).arg(_ratio.denominator()));
}

bool isSmall = true;
_isSmall = true;
for (const DurationElement* e : _elements) {
if (e->isChordRest() && !toChordRest(e)->isSmall()) {
isSmall = false;
if ((e->isChordRest() && !toChordRest(e)->isSmall()) || (e->isTuplet() && !toTuplet(e)->isSmall())) {
_isSmall = false;
break;
}
}
_number->setMag(isSmall ? score()->styleD(Sid::smallNoteMag) : 1.0);
_number->setMag(_isSmall ? score()->styleD(Sid::smallNoteMag) : 1.0);
} else {
if (_number) {
if (_number->selected()) {
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/libmscore/tuplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Tuplet final : public DurationElement
TDuration _baseLen; // 1/8 for a triplet of 1/8

bool _isUp;
bool _isSmall;

Fraction _tick;

Expand Down Expand Up @@ -138,6 +139,7 @@ class Tuplet final : public DurationElement
void setDirection(Direction d) { _direction = d; }
Direction direction() const { return _direction; }
bool isUp() const { return _isUp; }
bool isSmall() const { return _isSmall; }
Fraction tick() const override { return _tick; }
Fraction rtick() const override;
void setTick(const Fraction& v) { _tick = v; }
Expand Down

0 comments on commit 660c8ad

Please sign in to comment.