WebSharper

I'm trying to translate https://gist.github.com/mbostock/3750558 into F#, and I can get everything to work except for the dragstart event handler (https://gist.github.com/mbostock/3750558#file-index-html-L35):

1
var drag = force.drag().on("dragstart", dragstart);

In the WebSharper API force.Drag is a WebSharper.JavaScript.Function, which doesn't provide an .On method. I've also tried to treat the dragstart event in the same way as a click event:

1
2
3
someSelectionOfForceNodes
.Call(force.Drag)
.On("dragstart", dragstart) // dragstart handler not shown

but in this case the dragstart handler is never called.

What am I missing?

  • adam.granicz

    We have a similar example among our small set of WebSharper.D3 samples. What you have looks OK, what do you have for dragstart?

    • user4207

      I couldn't find any use of the dragstart event in those samples. Where you referring to the CompaniesGraph example?

      In any case, you can see the issue in http://try.websharper.com/snippet/user4207/0000CG. When a node is double-clicked the event handler is triggered, but when a node is dragged then the event handler is not triggered.