Skip to content

Commit 328ffd0

Browse files
committed
move reposition logic outside pie transformInsideText function
1 parent 0840d82 commit 328ffd0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/traces/pie/plot.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ function plot(gd, cdModule) {
175175

176176
transform = transformOutsideText(textBB, pt);
177177
}
178+
179+
if(transform.pxtxt) {
180+
// copy text position if not at the middle
181+
pt.pxtxt = transform.pxtxt;
182+
}
178183
}
179184

180185
var pxtxt = pt.pxtxt || pt.pxmid;
@@ -646,15 +651,7 @@ function transformInsideText(textBB, pt, cd0) {
646651
break;
647652
}
648653
}
649-
650-
var selTransform = allTransforms[id];
651-
652-
if(selTransform.pxtxt) {
653-
// copy text position if not at the middle
654-
pt.pxtxt = selTransform.pxtxt;
655-
}
656-
657-
return selTransform;
654+
return allTransforms[id];
658655
}
659656

660657
function isCrossing(pt, angle) {

src/traces/sunburst/plot.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ function plotOne(gd, cd, element, transitionOpts) {
264264
// position the text relative to the slice
265265
var textBB = Drawing.bBox(sliceText.node());
266266
pt.transform = transformInsideText(textBB, pt, cd0);
267+
if(pt.transform.pxtxt) {
268+
// copy text position if not at the middle
269+
pt.pxtxt = pt.transform.pxtxt;
270+
}
271+
267272
pt.transform.targetX = getTargetX(pt);
268273
pt.transform.targetY = getTargetY(pt);
269274

0 commit comments

Comments
 (0)