Skip to content

Commit

Permalink
Fix #329084: Horizontal aligment of accidentals in custom key signatu…
Browse files Browse the repository at this point in the history
…re editor

- accidentals are shifted to their normal h-positions
- if Control is pressed, free placement (like before)

Backport of musescore#10454
  • Loading branch information
sammik authored and Jojo-Schmitz committed May 12, 2022
1 parent 6023649 commit 1ef7f6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mscore/keyedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,16 @@ void KeyCanvas::dropEvent(QDropEvent*)
void KeyCanvas::snap(Accidental* a)
{
double y = a->ipos().y();
double spatium2 = gscore->spatium() * .5;
int line = int((y + spatium2 * .5) / spatium2);
double x = a->ipos().x();
double _spatium = gscore->spatium();
double spatium2 = _spatium * .5;
int line = int(y / spatium2 + .5);
int stepx = int(x / _spatium + .5);
y = line * spatium2;
x = stepx * _spatium;
a->rypos() = y;
if (!QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier))
a->rxpos() = x;
}

//---------------------------------------------------------
Expand Down

0 comments on commit 1ef7f6e

Please sign in to comment.