@@ -24,6 +24,8 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
24
24
var cd0 = cd [ 0 ] ;
25
25
var trace = cd0 . trace ;
26
26
var type = trace . type ;
27
+ var isIcicle = type === 'icicle' ;
28
+
27
29
var hierarchy = cd0 . hierarchy ;
28
30
var entry = helpers . findEntryWithLevel ( hierarchy , trace . level ) ;
29
31
@@ -260,10 +262,10 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
260
262
261
263
// Note that `pad` is just an integer for `icicle`` traces where
262
264
// `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 ;
264
266
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 ;
267
269
if ( x0 >= x1 ) {
268
270
var mid = ( x0 + x1 ) / 2 ;
269
271
x0 = mid ;
@@ -273,10 +275,10 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
273
275
// limit the drawing area for headers
274
276
var limY ;
275
277
if ( hasBottom ) {
276
- limY = y1 - ( type === 'icicle' ? pad : pad . b ) ;
278
+ limY = y1 - ( isIcicle ? pad : pad . b ) ;
277
279
if ( y0 < limY && limY < y1 ) y0 = limY ;
278
280
} else {
279
- limY = y0 + ( type === 'icicle' ? pad : pad . t ) ;
281
+ limY = y0 + ( isIcicle ? pad : pad . t ) ;
280
282
if ( y0 < limY && limY < y1 ) y1 = limY ;
281
283
}
282
284
}
@@ -377,7 +379,7 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
377
379
}
378
380
} else {
379
381
prev = Lib . extendFlat ( { } , pt ) ;
380
- if ( type === 'icicle' ) {
382
+ if ( isIcicle ) {
381
383
if ( opts . orientation === 'h' ) {
382
384
if ( opts . flipX ) prev . x0 = pt . x1 ;
383
385
else prev . x1 = 0 ;
0 commit comments