Skip to content

Commit b3bcdd6

Browse files
committed
improve style
1 parent dee73b8 commit b3bcdd6

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/traces/sankey/render.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,10 @@ function nodeModel(d, n, i) {
276276
var tc = tinycolor(n.color);
277277
var zoneThicknessPad = c.nodePadAcross;
278278
var zoneLengthPad = d.nodePad / 2;
279-
var visibleThickness = n.x1 - n.x0;
280-
var visibleLength = Math.max(0.5, (n.y1 - n.y0));
279+
n.dx = n.x1 - n.x0;
280+
n.dy = n.y1 - n.y0;
281+
var visibleThickness = n.dx;
282+
var visibleLength = Math.max(0.5, n.dy);
281283

282284
var basicKey = n.label;
283285
var key = basicKey + '__' + i;
@@ -286,10 +288,6 @@ function nodeModel(d, n, i) {
286288
n.trace = d.trace;
287289
n.curveNumber = d.trace.index;
288290

289-
// additionnal coordinates
290-
n.dx = n.x1 - n.x0;
291-
n.dy = n.y1 - n.y0;
292-
293291
return {
294292
index: n.pointNumber,
295293
key: key,
@@ -370,7 +368,7 @@ function textFlip(d) {return d.horizontal ? 'scale(1 1)' : 'scale(-1 1)';}
370368
function nodeTextColor(d) {return d.darkBackground && !d.horizontal ? 'rgb(255,255,255)' : 'rgb(0,0,0)';}
371369
function nodeTextOffset(d) {return d.horizontal && d.left ? '100%' : '0%';}
372370

373-
// // event handling
371+
// event handling
374372

375373
function attachPointerEvents(selection, sankey, eventSet) {
376374
selection
@@ -447,9 +445,7 @@ function attachDragHandler(sankeyNode, sankeyLink, callbacks) {
447445
if(d.arrangement === 'freeform') {
448446
d.node.x0 = x - d.visibleWidth / 2;
449447
d.node.x1 = x + d.visibleWidth / 2;
450-
// d.x0 = x;
451448
}
452-
// d.node.y = Math.max(d.node.dy / 2, Math.min(d.size - d.node.dy / 2, y));
453449
d.node.y0 = Math.max(0, Math.min(d.size - d.visibleHeight, y));
454450
d.node.y1 = d.node.y0 + d.visibleHeight;
455451
}

0 commit comments

Comments
 (0)