Skip to content

Commit

Permalink
Refactor DrawDivLine()
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Jan 18, 2024
1 parent 961c1bb commit ec4c4e6
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/view_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,6 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S
DivLine *divLine = dynamic_cast<DivLine *>(element);
assert(divLine);

// int x = divLine->GetDrawingX();
// int y = divLine->GetDrawingY();

dc->StartGraphic(element, "", element->GetID());

int sym = 0;
Expand All @@ -380,29 +377,14 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S
}

int x, y;
if (m_doc->IsFacs() && (divLine->HasFacs())) {
x = divLine->GetDrawingX();
y = ToLogicalY(staff->GetDrawingY());
}
else {
x = element->GetDrawingX();
y = element->GetDrawingY();
y -= m_doc->GetDrawingUnit(staff->m_drawingStaffSize);
}
x = element->GetDrawingX();
y = element->GetDrawingY();

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

int rotationOffset = 0;
if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) {
double deg = staff->GetDrawingRotate();
int xDiff = x - staff->GetDrawingX();
rotationOffset = int(xDiff * tan(deg * M_PI / 180.0));
if (staff->HasDrawingRotation()) {
y -= staff->GetDrawingRotationOffsetFor(x);
}
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 ec4c4e6

Please sign in to comment.