Skip to content

Commit 9067c1b

Browse files
fix(text transition): icicle text now smoothly transitions into its target location
1 parent b743eff commit 9067c1b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/traces/treemap/plot_one.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,12 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
249249
hasLeft ? -1 :
250250
hasRight ? 1 : 0;
251251

252+
// Note that `pad` is just an integer for `icicle`` traces where
253+
// `pad` is a hashmap for treemap: pad.t, pad.b, pad.l, and pad.r
252254
var pad = trace[type === 'icicle' ? 'tiling' : 'marker'].pad;
253255
if(opts.isHeader) {
254-
x0 += pad.l - TEXTPAD;
255-
x1 -= pad.r - TEXTPAD;
256+
x0 += (type === 'icicle' ? pad : pad.l) - TEXTPAD;
257+
x1 -= (type === 'icicle' ? pad : pad.r) - TEXTPAD;
256258
if(x0 >= x1) {
257259
var mid = (x0 + x1) / 2;
258260
x0 = mid;
@@ -262,10 +264,10 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
262264
// limit the drawing area for headers
263265
var limY;
264266
if(hasBottom) {
265-
limY = y1 - pad.b;
267+
limY = y1 - (type === 'icicle' ? pad : pad.b);
266268
if(y0 < limY && limY < y1) y0 = limY;
267269
} else {
268-
limY = y0 + pad.t;
270+
limY = y0 + (type === 'icicle' ? pad : pad.t);
269271
if(y0 < limY && limY < y1) y1 = limY;
270272
}
271273
}

0 commit comments

Comments
 (0)