3

I have the following attached to a svg element

var dragger = d3.behavior.drag()
.origin(function(d) {
  return d;
})
.on('drag', this.move)
.on('dragend', dropHandler);

//caller
var g = c.append('svg').call(dragger).data([{
x: x0,
y: y0
}]);

I am implementing some code inside the dropHandler function that needs it's own implementation of .on("drag",..). How do I remove the previous event handler from the code?

I tried the following:

.unbind()
selection.on("drag",null);
Arihant
  • 3,847
  • 16
  • 55
  • 86

1 Answers1

8

Found an answer: here

d3.select('rect#no-drag').on('mousedown.drag', null);
Community
  • 1
  • 1
Arihant
  • 3,847
  • 16
  • 55
  • 86