Skip to content

Commit

Permalink
Merge pull request musescore#24255 from mike-spa/fixVoltaAttachToDura…
Browse files Browse the repository at this point in the history
…tions

Always set start- and end-tick at measure boundaries for Volta
  • Loading branch information
miiizen committed Aug 29, 2024
2 parents e93f317 + 97d59cb commit 2d2f96c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/engraving/dom/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,11 @@ void Score::cmdAddSpanner(Spanner* spanner, staff_idx_t staffIdx, Segment* start
for (auto ss : spanner->spannerSegments()) {
ss->setTrack(track);
}
spanner->setTick(startSegment->tick());

bool isMeasureAnchor = spanner->anchor() == Spanner::Anchor::MEASURE;
Fraction tick1 = isMeasureAnchor ? startSegment->measure()->tick() : startSegment->tick();
spanner->setTick(tick1);

Fraction tick2;
if (!endSegment) {
tick2 = lastSegment()->tick();
Expand All @@ -621,6 +625,13 @@ void Score::cmdAddSpanner(Spanner* spanner, staff_idx_t staffIdx, Segment* start
} else {
tick2 = endSegment->tick();
}
if (isMeasureAnchor) {
Measure* endMeasure = tick2measureMM(tick2);
if (endMeasure->tick() != tick2) {
tick2 = endMeasure->endTick();
}
}

spanner->setTick2(tick2);
undoAddElement(spanner, true, ctrlModifier);
}
Expand Down
4 changes: 3 additions & 1 deletion src/engraving/dom/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6743,7 +6743,9 @@ void Score::undoInsertTime(const Fraction& tick, const Fraction& len)
}
for (Spanner* s : sl) {
if (len > Fraction(0, 1)) {
if (tick > s->tick() && tick < s->tick2()) {
if (tick == s->tick() && s->isVolta()) {
s->undoChangeProperty(Pid::SPANNER_TICKS, s->ticks() + len);
} else if (tick > s->tick() && tick < s->tick2()) {
//
// case a:
// +----spanner--------+
Expand Down

0 comments on commit 2d2f96c

Please sign in to comment.