Skip to content

Commit 4f789bd

Browse files
committed
refactor - moving variables
1 parent 4d24c36 commit 4f789bd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/traces/pie/plot.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,18 +559,21 @@ function prerenderTitles(cdModule, gd) {
559559
}
560560

561561
function transformInsideText(textBB, pt, cd0) {
562-
var textDiameter = Math.sqrt(textBB.width * textBB.width + textBB.height * textBB.height);
562+
var r = cd0.r || pt.rpx1;
563+
var rInscribed = pt.rInscribed;
564+
565+
var ring = pt.ring;
566+
var isCircle = (ring === 1) && (Math.abs(pt.startangle - pt.stopangle) === Math.PI * 2);
567+
563568
var halfAngle = pt.halfangle;
564569
var midAngle = pt.midangle;
565-
var ring = pt.ring;
566-
var rInscribed = pt.rInscribed;
567-
var r = cd0.r || pt.rpx1;
570+
568571
var orientation = cd0.trace.insidetextorientation;
569572
var isHorizontal = orientation === 'horizontal';
570573
var isTangential = orientation === 'tangential';
571574
var isRadial = orientation === 'radial';
572575
var isAuto = orientation === 'auto';
573-
var isCircle = (ring === 1) && (Math.abs(pt.startangle - pt.stopangle) === Math.PI * 2);
576+
574577
var allTransforms = [];
575578
var newT;
576579

@@ -616,6 +619,8 @@ function transformInsideText(textBB, pt, cd0) {
616619
// this inscribes the text rectangle in a circle, which is then inscribed
617620
// in the slice, so it will be an underestimate, which some day we may want
618621
// to improve so this case can get more use
622+
var textDiameter = Math.sqrt(textBB.width * textBB.width + textBB.height * textBB.height);
623+
619624
newT = {
620625
scale: rInscribed * r * 2 / textDiameter,
621626

0 commit comments

Comments
 (0)