Skip to content

Commit

Permalink
Refactor staff rotation offset in view_neume
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Jan 14, 2024
1 parent b4a4687 commit 5a9d665
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/view_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,7 @@ void View::DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff
}
int octaveOffset = (nc->GetOct() - clefOctave) * ((staffSize / 2) * 7);
int rotationOffset = 0;
if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) {
double deg = staff->GetDrawingRotate();
int xDiff = noteX - staff->GetDrawingX();
rotationOffset = int(xDiff * tan(deg * M_PI / 180.0));
}
else if (staff->HasDrawingRotation()) {
if (staff->HasDrawingRotation()) {
rotationOffset = staff->GetDrawingRotationOffsetFor(noteX);
}

Expand Down Expand Up @@ -359,17 +354,10 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S

y -= (m_doc->GetDrawingUnit(staff->m_drawingStaffSize)) * 3;

int rotationOffset = 0;
if (m_doc->IsTranscription() && (staff->GetDrawingRotate() != 0)) {
double deg = staff->GetDrawingRotate();
int xDiff = x - staff->GetDrawingX();
rotationOffset = int(xDiff * tan(deg * M_PI / 180.0));
if (staff->HasDrawingRotation()) {
int rotationOffset = staff->GetDrawingRotationOffsetFor(x);
y -= rotationOffset;
}
else if (staff->HasDrawingRotation()) {
rotationOffset = staff->GetDrawingRotationOffsetFor(x);
}

y -= rotationOffset;

DrawSmuflCode(dc, x, y, sym, staff->m_drawingStaffSize, false, true);

Expand Down

0 comments on commit 5a9d665

Please sign in to comment.