@@ -24,6 +24,8 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
2424 var cd0 = cd [ 0 ] ;
2525 var trace = cd0 . trace ;
2626 var type = trace . type ;
27+ var isIcicle = type === 'icicle' ;
28+
2729 var hierarchy = cd0 . hierarchy ;
2830 var entry = helpers . findEntryWithLevel ( hierarchy , trace . level ) ;
2931
@@ -260,10 +262,10 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
260262
261263 // Note that `pad` is just an integer for `icicle`` traces where
262264 // `pad` is a hashmap for treemap: pad.t, pad.b, pad.l, and pad.r
263- var pad = trace [ type === 'icicle' ? 'tiling' : 'marker' ] . pad ;
265+ var pad = trace [ isIcicle ? 'tiling' : 'marker' ] . pad ;
264266 if ( opts . isHeader ) {
265- x0 += ( type === 'icicle' ? pad : pad . l ) - TEXTPAD ;
266- x1 -= ( type === 'icicle' ? pad : pad . r ) - TEXTPAD ;
267+ x0 += ( isIcicle ? pad : pad . l ) - TEXTPAD ;
268+ x1 -= ( isIcicle ? pad : pad . r ) - TEXTPAD ;
267269 if ( x0 >= x1 ) {
268270 var mid = ( x0 + x1 ) / 2 ;
269271 x0 = mid ;
@@ -273,10 +275,10 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
273275 // limit the drawing area for headers
274276 var limY ;
275277 if ( hasBottom ) {
276- limY = y1 - ( type === 'icicle' ? pad : pad . b ) ;
278+ limY = y1 - ( isIcicle ? pad : pad . b ) ;
277279 if ( y0 < limY && limY < y1 ) y0 = limY ;
278280 } else {
279- limY = y0 + ( type === 'icicle' ? pad : pad . t ) ;
281+ limY = y0 + ( isIcicle ? pad : pad . t ) ;
280282 if ( y0 < limY && limY < y1 ) y1 = limY ;
281283 }
282284 }
@@ -377,7 +379,7 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
377379 }
378380 } else {
379381 prev = Lib . extendFlat ( { } , pt ) ;
380- if ( type === 'icicle' ) {
382+ if ( isIcicle ) {
381383 if ( opts . orientation === 'h' ) {
382384 if ( opts . flipX ) prev . x0 = pt . x1 ;
383385 else prev . x1 = 0 ;
0 commit comments