@@ -167,7 +167,7 @@ function plot(gd, cdModule) {
167
167
if ( textPosition === 'outside' ) {
168
168
transform = transformOutsideText ( textBB , pt ) ;
169
169
} else {
170
- transform = transformInsideText ( textBB , pt , cd0 ) ;
170
+ transform = transformInsideText ( textBB , pt , cd0 , fullLayout ) ;
171
171
if ( textPosition === 'auto' && transform . scale < 1 ) {
172
172
var newFont = Lib . ensureUniformFontSize ( gd , trace . outsidetextfont ) ;
173
173
@@ -635,7 +635,7 @@ function prerenderTitles(cdModule, gd) {
635
635
}
636
636
}
637
637
638
- function transformInsideText ( textBB , pt , cd0 ) {
638
+ function transformInsideText ( textBB , pt , cd0 , fullLayout ) {
639
639
var r = cd0 . r || pt . rpx1 ;
640
640
var rInscribed = pt . rInscribed ;
641
641
@@ -660,6 +660,7 @@ function transformInsideText(textBB, pt, cd0) {
660
660
var isTangential = orientation === 'tangential' ;
661
661
var isRadial = orientation === 'radial' ;
662
662
var isAuto = orientation === 'auto' ;
663
+ var isUniformModeHide = fullLayout . uniformtext . mode === 'hide' ;
663
664
664
665
var allTransforms = [ ] ;
665
666
var newT ;
@@ -723,7 +724,7 @@ function transformInsideText(textBB, pt, cd0) {
723
724
}
724
725
725
726
if ( isAuto || isRadial ) {
726
- newT = calcRadTransform ( textBB , r , ring , halfAngle , midAngle ) ;
727
+ newT = calcRadTransform ( textBB , r , ring , halfAngle , midAngle , isUniformModeHide ) ;
727
728
newT . textPosAngle = ( pt . startangle + pt . stopangle ) / 2 ;
728
729
allTransforms . push ( newT ) ;
729
730
}
@@ -760,15 +761,15 @@ function isCrossing(pt, angle) {
760
761
) ;
761
762
}
762
763
763
- function calcRadTransform ( textBB , r , ring , halfAngle , midAngle ) {
764
+ function calcRadTransform ( textBB , r , ring , halfAngle , midAngle , isUniformModeHide ) {
764
765
r = Math . max ( 0 , r - 2 * TEXTPAD ) ;
765
766
766
767
// max size if text is rotated radially
767
768
var a = textBB . width / textBB . height ;
768
769
var s = calcMaxHalfSize ( a , halfAngle , r , ring ) ;
769
770
return {
770
771
scale : s * 2 / textBB . height ,
771
- rCenter : calcRCenter ( a , s / r ) ,
772
+ rCenter : isUniformModeHide ? calcRingCenter ( ring ) : calcRCenter ( a , s / r ) ,
772
773
rotate : calcRotate ( midAngle )
773
774
} ;
774
775
}
@@ -790,6 +791,10 @@ function calcRCenter(a, b) {
790
791
return Math . cos ( b ) - a * b ;
791
792
}
792
793
794
+ function calcRingCenter ( ring ) {
795
+ return 1 - ring / 2 ;
796
+ }
797
+
793
798
function calcRotate ( t ) {
794
799
return ( 180 / Math . PI * t + 720 ) % 180 - 90 ;
795
800
}
0 commit comments