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

Skip to content

Commit e3a117c

Browse files
committed
factor out util
(cherry picked from commit 07e2856)
1 parent 00856ad commit e3a117c

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
@@ -143,6 +143,13 @@ lib.pauseEvent = function(e) {
143143
return false;
144144
};
145145

146+
/**
147+
* SVG painter's algo worked around with reinsertion
148+
*/
149+
lib.raiseToTop = function raiseToTop(elem) {
150+
elem.parentNode.appendChild(elem);
151+
};
152+
146153
// constrain - restrict a number v to be between v0 and v1
147154
lib.constrain = function(v, v0, v1) {
148155
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
@@ -325,7 +325,7 @@ function attachDragHandler(sankeyNode, sankeyLink, callbacks) {
325325

326326
.on('dragstart', function(d) {
327327
if(d.arrangement === 'fixed') return;
328-
this.parentNode.appendChild(this); // bring element to top (painter's algo)
328+
Lib.raiseToTop(this);
329329
d.interactionState.dragInProgress = d.node;
330330
saveCurrentDragPosition(d.node);
331331
if(d.interactionState.hovered) {

0 commit comments

Comments
 (0)