Skip to content

Commit

Permalink
fix #314854: element offset marked nostyle after edit
Browse files Browse the repository at this point in the history
Resolves: https://musescore.org/en/node/314854

Currently, on any drag operation in edit mode
(including "drag" via arrow keys, which uses the same code),
the offset is set to NOSTYLE, whereas it should be UNSTYLED
(if it was previously styled).
The result is that after such an edit, the offset can no longer
be reset to its original STYLED state,
so it even after a reset of the offset itself,
it remains marked as NOSTYLE and will not respond to style changes,

There is code in the ordinary drag case (Element::endDrag())
to handle this, but it is missing from the edit mode version.
The fix here is to simply reproduce that code in Element::endEditDrag().
  • Loading branch information
MarcSabatella authored and vpereverzev committed Dec 29, 2020
1 parent afc9a70 commit 4084486
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libmscore/element.cpp
Expand Up @@ -2099,9 +2099,9 @@ QVector<QLineF> Element::genericDragAnchorLines() const
if (parent()->isSegment()) {
System* system = toSegment(parent())->measure()->system();
const int stIdx = staffIdx();
yp = system->staffCanvasYpage(stIdx);
yp = system ? system->staffCanvasYpage(stIdx) : 0.0;
if (placement() == Placement::BELOW)
yp += system->staff(stIdx)->bbox().height();
yp += system ? system->staff(stIdx)->bbox().height() : 0.0;
//adjust anchor Y positions to staffType offset
if (staff())
yp += staff()->staffTypeForElement(this)->yoffset().val()* spatium();
Expand Down Expand Up @@ -2191,7 +2191,10 @@ void Element::endEditDrag(EditData& ed)
if (eed) {
for (const PropertyData &pd : qAsConst(eed->propertyData)) {
setPropertyFlags(pd.id, pd.f); // reset initial property flags state
if (score()->undoPropertyChanged(this, pd.id, pd.data))
PropertyFlags f = pd.f;
if (f == PropertyFlags::STYLED)
f = PropertyFlags::UNSTYLED;
if (score()->undoPropertyChanged(this, pd.id, pd.data, f))
changed = true;
}
eed->propertyData.clear();
Expand Down

0 comments on commit 4084486

Please sign in to comment.