Skip to content

Commit 8d3d3f2

Browse files
committed
fix #27686
1 parent ae475eb commit 8d3d3f2

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

libmscore/cmd.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -553,22 +553,16 @@ Segment* Score::setNoteRest(Segment* segment, int track, NoteVal nval, Fraction
553553
//
554554
// extend slur
555555
//
556-
Chord* e = static_cast<Note*>(nr)->chord();
557-
int stick = 0;
558-
Element* ee = _is.slur()->startElement();
559-
if (!ee)
560-
stick = e->tick();
561-
else if (ee->isChordRest())
562-
stick = static_cast<ChordRest*>(ee)->tick();
563-
else if (ee->type() == Element::Type::NOTE)
564-
stick = static_cast<Note*>(ee)->chord()->tick();
565-
if (stick == e->tick()) {
566-
_is.slur()->setTick(stick);
567-
_is.slur()->setStartElement(e);
568-
}
569-
else {
570-
_is.slur()->setTick2(e->tick());
571-
_is.slur()->setEndElement(e);
556+
Chord* chord = static_cast<Note*>(nr)->chord();
557+
_is.slur()->undoChangeProperty(P_ID::SPANNER_TICK2, chord->tick());
558+
for (Element* e : _is.slur()->linkList()) {
559+
Slur* slur = static_cast<Slur*>(e);
560+
for (Element* e : chord->linkList()) {
561+
if (e->score() == slur->score() && e->track() == slur->track2()) {
562+
slur->score()->undo(new ChangeSpannerElements(slur, slur->startElement(), e));
563+
break;
564+
}
565+
}
572566
}
573567
setLayoutAll(true);
574568
}

libmscore/undo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3337,7 +3337,7 @@ void ChangeProperty::flip()
33373337
<< property
33383338
;
33393339
#endif
3340-
if (id == P_ID::SPANNER_TICK)
3340+
if (id == P_ID::SPANNER_TICK || id == P_ID::SPANNER_TICK2)
33413341
element->score()->removeSpanner(static_cast<Spanner*>(element));
33423342

33433343
QVariant v = element->getProperty(id);
@@ -3347,7 +3347,7 @@ void ChangeProperty::flip()
33473347
else
33483348
element->setProperty(id, property);
33493349

3350-
if (id == P_ID::SPANNER_TICK)
3350+
if (id == P_ID::SPANNER_TICK || id == P_ID::SPANNER_TICK2)
33513351
element->score()->addSpanner(static_cast<Spanner*>(element));
33523352
property = v;
33533353
propertyStyle = ps;

0 commit comments

Comments
 (0)