From 5a9d66588f5f21b44ad2dd19ab69b33d6ebf240b Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 14 Jan 2024 17:12:17 -0500 Subject: [PATCH] Refactor staff rotation offset in view_neume --- src/view_neume.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/view_neume.cpp b/src/view_neume.cpp index 10413c855c..2e6b01e4f3 100644 --- a/src/view_neume.cpp +++ b/src/view_neume.cpp @@ -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); } @@ -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);