@@ -19,6 +19,7 @@ var Drawing = require('../../components/drawing');
1919var Registry = require ( '../../registry' ) ;
2020var tickText = require ( '../../plots/cartesian/axes' ) . tickText ;
2121
22+ var uniformText = require ( './uniform_text' ) ;
2223var style = require ( './style' ) ;
2324var helpers = require ( './helpers' ) ;
2425var constants = require ( './constants' ) ;
@@ -93,7 +94,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
9394 } ;
9495
9596 // don't clear bar when this is called from waterfall or funnel
96- clearMinTextSize ( 'bar' , fullLayout ) ;
97+ uniformText . clearMinTextSize ( 'bar' , fullLayout ) ;
9798 }
9899
99100 var bartraces = Lib . makeTraceGroups ( traceLayer , cdModule , 'trace bars' ) . each ( function ( cd ) {
@@ -409,47 +410,13 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
409410 }
410411
411412 transform . fontSize = font . size ;
412- recordMinTextSize ( trace . type , transform , fullLayout ) ;
413+ uniformText . recordMinTextSize ( trace . type , transform , fullLayout ) ;
413414 calcBar . transform = transform ;
414415
415416 transition ( textSelection , fullLayout , opts , makeOnCompleteCallback )
416417 . attr ( 'transform' , Lib . getTextTransform ( transform ) ) ;
417418}
418419
419- function recordMinTextSize (
420- traceType , // in
421- transform , // inout
422- fullLayout // inout
423- ) {
424- if ( fullLayout . uniformtext . mode ) {
425- var minKey = getMinKey ( traceType ) ;
426- var minSize = fullLayout . uniformtext . minsize ;
427- var size = transform . scale * transform . fontSize ;
428-
429- transform . hide = size < minSize ;
430-
431- fullLayout [ minKey ] = fullLayout [ minKey ] || Infinity ;
432- if ( ! transform . hide ) {
433- fullLayout [ minKey ] = Math . min (
434- fullLayout [ minKey ] ,
435- Math . max ( size , minSize )
436- ) ;
437- }
438- }
439- }
440-
441- function clearMinTextSize (
442- traceType , // in
443- fullLayout // inout
444- ) {
445- var minKey = getMinKey ( traceType ) ;
446- fullLayout [ minKey ] = undefined ;
447- }
448-
449- function getMinKey ( traceType ) {
450- return '_' + traceType + 'Text_minsize' ;
451- }
452-
453420function getRotateFromAngle ( angle ) {
454421 return ( angle === 'auto' ) ? 0 : angle ;
455422}
@@ -769,7 +736,5 @@ function calcTextinfo(cd, index, xa, ya) {
769736
770737module . exports = {
771738 plot : plot ,
772- toMoveInsideBar : toMoveInsideBar ,
773- recordMinTextSize : recordMinTextSize ,
774- clearMinTextSize : clearMinTextSize
739+ toMoveInsideBar : toMoveInsideBar
775740} ;
0 commit comments