Skip to content

Commit 284bf6d

Browse files
committed
add constant zero fillet - could expose that in next version
1 parent 36fb510 commit 284bf6d

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/traces/treemap/plot.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,24 @@ function plotOne(gd, cd, element, transitionOpts) {
260260
var _y0 = viewMapY(d.y0);
261261
var _y1 = viewMapY(d.y1);
262262

263+
var FILLET = 0; // TODO: may expose this constant
264+
265+
var r = (
266+
_x1 - _x0 > 2 * FILLET &&
267+
_y1 - _y0 > 2 * FILLET
268+
) ? FILLET : 0;
269+
270+
var arc = function(rx, ry) { return r ? 'a' + pos(r, r) + ' 0 0 1 ' + pos(rx, ry) : ''; };
271+
263272
return noNaN(
264-
'M' + pos(_x0, _y0) +
265-
'L' + pos(_x1, _y0) +
266-
'L' + pos(_x1, _y1) +
267-
'L' + pos(_x0, _y1) + 'Z'
273+
'M' + pos(_x0, _y0 + r) +
274+
arc(r, -r) +
275+
'L' + pos(_x1 - r, _y0) +
276+
arc(r, r) +
277+
'L' + pos(_x1, _y1 - r) +
278+
arc(-r, r) +
279+
'L' + pos(_x0 + r, _y1) +
280+
arc(-r, -r) + 'Z'
268281
);
269282
};
270283

0 commit comments

Comments
 (0)