Skip to content

Commit fd82ab6

Browse files
committed
fix slur/tie regression
1 parent 864ea88 commit fd82ab6

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

libmscore/element.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,9 @@ bool Element::readProperties(XmlReader& e)
778778
e.initTick(score()->fileDivision(val));
779779
}
780780
}
781-
else if (tag == "offset")
781+
else if (tag == "offset") {
782782
setUserOff(e.readPoint() * spatium());
783+
}
783784
else if (tag == "pos") {
784785
QPointF pt = e.readPoint();
785786
if (score()->mscVersion() > 114)

libmscore/slur.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ QList<SlurOffsets> SlurTie::editUps;
4343
SlurSegment::SlurSegment(Score* score)
4444
: SpannerSegment(score)
4545
{
46+
setFlag(ElementFlag::ON_STAFF, true);
4647
autoAdjustOffset = QPointF();
4748
}
4849

@@ -113,6 +114,7 @@ void SlurSegment::updateGrips(int* n, int* defaultGrip, QRectF* r) const
113114
*n = int(GripSlurSegment::GRIPS);
114115
*defaultGrip = int(GripSlurSegment::END);
115116
QPointF p(pagePos());
117+
p -= QPointF(0.0, system()->staff(staffIdx())->y()); // ??
116118
for (int i = 0; i < int(GripSlurSegment::GRIPS); ++i)
117119
r[i].translate(ups[i].p + ups[i].off * spatium() + p);
118120
}
@@ -453,10 +455,6 @@ void SlurSegment::read(XmlReader& e)
453455
else if (!Element::readProperties(e))
454456
e.unknown();
455457
}
456-
if ((staffIdx() > 0) && score()->mscVersion() < 201) {
457-
//discard any user tweaking for older scores
458-
setReadPos(QPointF());
459-
}
460458
}
461459

462460
//---------------------------------------------------------
@@ -564,10 +562,6 @@ void Slur::computeBezier(SlurSegment* ss, QPointF p6o)
564562
ss->shapePath.cubicTo(p3 + p3o - th, p4 + p4o - th, p2);
565563
ss->shapePath.cubicTo(p4 +p4o + th, p3 + p3o + th, QPointF());
566564

567-
QPointF staffOffset;
568-
if (ss->system() && ss->track() >= 0)
569-
staffOffset = QPointF(0.0, -ss->system()->staff(ss->staffIdx())->y());
570-
571565
// translate back
572566
t.reset();
573567
t.translate(pp1.x(), pp1.y());
@@ -580,6 +574,10 @@ void Slur::computeBezier(SlurSegment* ss, QPointF p6o)
580574
ss->ups[int(GripSlurSegment::DRAG)].p = t.map(p5);
581575
ss->ups[int(GripSlurSegment::SHOULDER)].p = t.map(p6);
582576

577+
QPointF staffOffset;
578+
if (ss->system() && ss->track() >= 0)
579+
staffOffset = QPointF(0.0, -ss->system()->staff(ss->staffIdx())->y());
580+
583581
ss->path.translate(staffOffset);
584582
ss->shapePath.translate(staffOffset);
585583
}
@@ -644,6 +642,12 @@ void SlurSegment::layout(const QPointF& p1, const QPointF& p2)
644642
}
645643
}
646644
setbbox(path.boundingRect());
645+
if ((staffIdx() > 0) && score()->mscVersion() < 201 && !readPos().isNull()) {
646+
QPointF staffOffset;
647+
if (system() && track() >= 0)
648+
staffOffset = QPointF(0.0, system()->staff(staffIdx())->y());
649+
setReadPos(readPos() + staffOffset);
650+
}
647651
adjustReadPos();
648652
}
649653

@@ -1431,7 +1435,6 @@ void Slur::layout()
14311435
}
14321436
SlurSegment* segment = segmentAt(i);
14331437
segment->setSystem(system);
1434-
segment->setFlag(ElementFlag::ON_STAFF, true);
14351438

14361439
// case 1: one segment
14371440
if (sPos.system1 == sPos.system2) {

libmscore/tie.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ void Tie::computeBezier(SlurSegment* ss, QPointF p6o)
138138
ss->ups[int(GripSlurSegment::END)].p = t.map(p2) - ss->ups[int(GripSlurSegment::END)].off * _spatium;
139139
ss->ups[int(GripSlurSegment::DRAG)].p = t.map(p5);
140140
ss->ups[int(GripSlurSegment::SHOULDER)].p = t.map(p6);
141+
142+
QPointF staffOffset;
143+
if (ss->system() && ss->track() >= 0)
144+
staffOffset = QPointF(0.0, -ss->system()->staff(ss->staffIdx())->y());
145+
146+
ss->path.translate(staffOffset);
147+
ss->shapePath.translate(staffOffset);
141148
}
142149

143150
//---------------------------------------------------------

0 commit comments

Comments
 (0)