Skip to content

Commit

Permalink
Avoiding control events to remain in the space between the staff and …
Browse files Browse the repository at this point in the history
…a layer element
  • Loading branch information
lpugin committed Jun 14, 2017
1 parent afe0b3f commit a8b56bd
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/floatingobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,14 @@ bool FloatingPositioner::CalcDrawingYRel(Doc *doc, StaffAlignment *staffAlignmen
}
return true;
}
if (this->VerticalContentOverlap(horizOverlapingBBox, margin)) {
yRel = -staffAlignment->CalcOverflowAbove(horizOverlapingBBox) + GetContentY1() - margin;
yRel = -staffAlignment->CalcOverflowAbove(horizOverlapingBBox) + GetContentY1() - margin;
Object *object = dynamic_cast<Object*>(horizOverlapingBBox);
// With LayerElement always move them up
if (object && object->IsLayerElement()) {
if (yRel < 0) this->SetDrawingYRel(yRel);
}
// Otherwise only if the is a vertical overlap
else if (this->VerticalContentOverlap(horizOverlapingBBox, margin)) {
this->SetDrawingYRel(yRel);
}
}
Expand All @@ -341,9 +347,15 @@ bool FloatingPositioner::CalcDrawingYRel(Doc *doc, StaffAlignment *staffAlignmen
}
return true;
}
if (this->VerticalContentOverlap(horizOverlapingBBox, margin)) {
yRel = staffAlignment->CalcOverflowBelow(horizOverlapingBBox) + staffAlignment->GetStaffHeight()
+ GetContentY2() + margin;
yRel = staffAlignment->CalcOverflowBelow(horizOverlapingBBox) + staffAlignment->GetStaffHeight()
+ GetContentY2() + margin;
Object *object = dynamic_cast<Object*>(horizOverlapingBBox);
// With LayerElement always move them down
if (object && object->IsLayerElement()) {
if (yRel > 0) this->SetDrawingYRel(yRel);
}
// Otherwise only if the is a vertical overlap
else if (this->VerticalContentOverlap(horizOverlapingBBox, margin)) {
this->SetDrawingYRel(yRel);
}
}
Expand Down

0 comments on commit a8b56bd

Please sign in to comment.