My current setup involves using D3 to drag and drop links in the following manner:
.call(d3.drag()
.on("start", linkDragStart)
.on("drag", linkDragging)
.on("end", linkDragEnd));
Recently, I decided to extract this functionality into a separate method instead of keeping it within the main method. Therefore, my modified code looks like this:
.call(d3.drag()
.on("start", linkDragStart)
.on("drag", linkDragging)
.on("end", this.linkDragEnd));
While the method is now being invoked, I'm facing an issue where using the 'this' keyword inside the linkDragEnd
method refers back to the d3-path on which the method is being called. Is there a way to work around this problem?