Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07e2856

Browse files
committed
factor out util
1 parent 953fd72 commit 07e2856

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/lib/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ lib.pauseEvent = function(e) {
135135
return false;
136136
};
137137

138+
/**
139+
* SVG painter's algo worked around with reinsertion
140+
*/
141+
lib.raiseToTop = function raiseToTop(elem) {
142+
elem.parentNode.appendChild(elem);
143+
};
144+
138145
// constrain - restrict a number v to be between v0 and v1
139146
lib.constrain = function(v, v0, v1) {
140147
if(v0 > v1) return Math.max(v1, Math.min(v0, v));

src/traces/sankey/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ function attachDragHandler(sankeyNode, sankeyLink, callbacks) {
317317

318318
.on('dragstart', function(d) {
319319
if(d.arrangement === 'fixed') return;
320-
this.parentNode.appendChild(this); // bring element to top (painter's algo)
320+
Lib.raiseToTop(this);
321321
d.interactionState.dragInProgress = d.node;
322322
saveCurrentDragPosition(d.node);
323323
if(d.interactionState.hovered) {

0 commit comments

Comments
 (0)