fix #276126 Voltas are incorrectly positioned
This commit is contained in:
parent
5d52ccf73e
commit
eb1bf102d3
3 changed files with 24 additions and 13 deletions
|
@ -3364,17 +3364,19 @@ System* Score::collectSystem(LayoutContext& lc)
|
|||
//
|
||||
// vertical align volta segments
|
||||
//
|
||||
std::vector<SpannerSegment*> voltaSegments;
|
||||
for (SpannerSegment* ss : system->spannerSegments()) {
|
||||
if (ss->isVoltaSegment())
|
||||
voltaSegments.push_back(ss);
|
||||
}
|
||||
if (voltaSegments.size() > 1) {
|
||||
qreal y = 0;
|
||||
for (SpannerSegment* ss : voltaSegments)
|
||||
y = qMin(y, ss->userOff().y());
|
||||
for (SpannerSegment* ss : voltaSegments)
|
||||
ss->setUserYoffset(y);
|
||||
for (int staffIdx = 0; staffIdx < nstaves(); ++staffIdx) {
|
||||
std::vector<SpannerSegment*> voltaSegments;
|
||||
for (SpannerSegment* ss : system->spannerSegments()) {
|
||||
if (ss->isVoltaSegment() && ss->staffIdx() == staffIdx)
|
||||
voltaSegments.push_back(ss);
|
||||
}
|
||||
if (voltaSegments.size() > 1) {
|
||||
qreal y = 0;
|
||||
for (SpannerSegment* ss : voltaSegments)
|
||||
y = qMin(y, ss->userOff().y());
|
||||
for (SpannerSegment* ss : voltaSegments)
|
||||
ss->setUserYoffset(y);
|
||||
}
|
||||
}
|
||||
for (Spanner* sp : _unmanagedSpanner) {
|
||||
if (sp->tick() >= etick || sp->tick2() < stick)
|
||||
|
|
|
@ -47,6 +47,14 @@ static const ElementStyle voltaStyle {
|
|||
{ Sid::voltaHook, Pid::END_HOOK_HEIGHT },
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// VoltaSegment
|
||||
//---------------------------------------------------------
|
||||
|
||||
VoltaSegment::VoltaSegment(Score* s) : TextLineBaseSegment(s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// layout
|
||||
//---------------------------------------------------------
|
||||
|
@ -54,7 +62,7 @@ static const ElementStyle voltaStyle {
|
|||
void VoltaSegment::layout()
|
||||
{
|
||||
TextLineBaseSegment::layout();
|
||||
autoplaceSpannerSegment(spatium() * .7, Sid::voltaY, Sid::voltaY);
|
||||
autoplaceSpannerSegment(spatium() * 1.0, Sid::voltaY, Sid::voltaY);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -75,6 +83,7 @@ Element* VoltaSegment::propertyDelegate(Pid pid)
|
|||
Volta::Volta(Score* s)
|
||||
: TextLineBase(s, ElementFlag::SYSTEM)
|
||||
{
|
||||
setPlacement(Placement::ABOVE);
|
||||
initElementStyle(&voltaStyle);
|
||||
|
||||
setBeginTextPlace(PlaceText::BELOW);
|
||||
|
|
|
@ -31,7 +31,7 @@ extern LineSegment* voltaDebug;
|
|||
|
||||
class VoltaSegment final : public TextLineBaseSegment {
|
||||
public:
|
||||
VoltaSegment(Score* s) : TextLineBaseSegment(s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {}
|
||||
VoltaSegment(Score* s);
|
||||
virtual ElementType type() const override { return ElementType::VOLTA_SEGMENT; }
|
||||
virtual VoltaSegment* clone() const override { return new VoltaSegment(*this); }
|
||||
Volta* volta() const { return (Volta*)spanner(); }
|
||||
|
|
Loading…
Reference in a new issue