Skip to content

Commit

Permalink
Merge pull request #3993 from mattmcclinch/246156-drag-tied-notes
Browse files Browse the repository at this point in the history
fix #246156: Dragging a note does not affect the notes tied to it
  • Loading branch information
anatoly-os committed Oct 25, 2018
2 parents 96af32e + 69d3074 commit ea78f4b
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1532,31 +1532,29 @@ QRectF Note::drag(EditData& ed)
int nString = ned->string + (st->upsideDown() ? -lineOffset : lineOffset);
int nFret = strData->fret(_pitch, nString, staff(), _tick);
if (nFret >= 0) { // no fret?
bool refret = false;
if (fret() != nFret) {
_fret = nFret;
refret = true;
}
if (string() != nString) {
_string = nString;
refret = true;
}
if (refret) {
strData->fretChords(chord());
triggerLayout();
if (fret() != nFret || string() != nString) {
for (Note* nn : tiedNotes()) {
nn->setFret(nFret);
nn->setString(nString);
strData->fretChords(nn->chord());
nn->triggerLayout();
}
}
}
}
else {
Key key = staff()->key(_tick);
_pitch = line2pitch(ned->line + lineOffset, staff()->clef(_tick), key);
int newPitch = line2pitch(ned->line + lineOffset, staff()->clef(_tick), key);
if (!concertPitch()) {
Interval interval = staff()->part()->instrument(_tick)->transpose();
_pitch += interval.chromatic;
newPitch += interval.chromatic;
}
int newTpc1 = pitch2tpc(newPitch, key, Prefer::NEAREST);
int newTpc2 = pitch2tpc(newPitch - transposition(), key, Prefer::NEAREST);
for (Note* nn : tiedNotes()) {
nn->setPitch(newPitch, newTpc1, newTpc2);
nn->triggerLayout();
}
_tpc[0] = pitch2tpc(_pitch, key, Prefer::NEAREST);
_tpc[1] = pitch2tpc(_pitch - transposition(), key, Prefer::NEAREST);
triggerLayout();
}
return QRectF();
}
Expand Down

0 comments on commit ea78f4b

Please sign in to comment.