chart2/source/view/charttypes/PieChart.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 5e81ce5aec86ef5a93cc9cb4445fc4983e8a59ea
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Jan 25 08:41:41 2024 -0500
Commit:     Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Sun Jan 28 05:40:51 2024 +0100

    chart2: use NormAngle360
    
    In various places, the degrees refer to an area/width,
    and in those cases 360 means everything, so mk correctly
    removed NormAngle for those situations.
    
    But now copy/paste has added that to areas where a simple
    angle is being described, and in those cases
    using NormAngle360 is better.
    
    Change-Id: I4aa722c4a635f862dae5405f2ee929215a42faf9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162585
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins

diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index b9dd0517cf1f..efbef5a083eb 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -386,12 +386,10 @@ void PieChart::createTextLabelShape(
             aOuterCirclePoint.Y - aPieLabelInfo.aOrigin.getY() );
     double fSquaredPieRadius = aRadiusVector.scalar(aRadiusVector);
     double fPieRadius = sqrt( fSquaredPieRadius );
-    double fAngleDegree
-        = rParam.mfUnitCircleStartAngleDegree + 
rParam.mfUnitCircleWidthAngleDegree / 2.0;
-    while (fAngleDegree > 360.0)
-        fAngleDegree -= 360.0;
-    while (fAngleDegree < 0.0)
-        fAngleDegree += 360.0;
+    const double fHalfWidthAngleDegree = rParam.mfUnitCircleWidthAngleDegree / 
2.0;
+    // fAngleDegree: the angle through the center of the slice / the bisecting 
ray
+    const double fAngleDegree
+        = NormAngle360(rParam.mfUnitCircleStartAngleDegree + 
fHalfWidthAngleDegree);
 
     awt::Point aOuterPosition = 
PlottingPositionHelper::transformSceneToScreenPosition(
         m_aPosHelper.transformUnitCircleToScene(fAngleDegree, 
rParam.mfUnitCircleOuterRadius, 0),

Reply via email to