Skip to content

Commit

Permalink
Merge pull request #19552 from miiizen/19489-fermata-rest
Browse files Browse the repository at this point in the history
Centre fermatas over rests on resized staves
  • Loading branch information
cbjeukendrup committed Sep 29, 2023
2 parents b005132 + 34be935 commit 5791ea7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/engraving/dom/rest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,13 @@ double Rest::rightEdge() const
return x() + width();
}

double Rest::centerX() const
{
SymId sym = layoutData()->sym();
RectF bbox = symBbox(sym);
return bbox.left() + bbox.width() / 2;
}

//---------------------------------------------------------
// accent
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/rest.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class Rest : public ChordRest
double stemPosX() const override;
mu::PointF stemPosBeam() const override;
double rightEdge() const override;
double centerX() const;

void localSpatiumChanged(double oldValue, double newValue) override;
PropertyValue propertyDefault(Pid) const override;
Expand Down
4 changes: 4 additions & 0 deletions src/engraving/rendering/dev/tlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,10 @@ void TLayout::layout(const Fermata* item, Fermata::LayoutData* ldata, const Layo
const Chord* chord = toChord(e);
x = chord->x() + chord->centerX();
y = chord->y();
} else if (e->isRest()) {
const Rest* rest = toRest(e);
x = rest->x() + rest->centerX();
y = rest->y();
} else {
x = e->x() - e->shape().left() + e->width() * item->staff()->staffMag(Fraction(0, 1)) * .5;
y = e->y();
Expand Down
Binary file added vtest/scores/fermata-4.mscz
Binary file not shown.

0 comments on commit 5791ea7

Please sign in to comment.