I need to display an SVG which is interactive (i.e. reacts to user inputs on mouse and keyboard). What are the options right now? Neither js_of_ocaml nor bucklescript seem to handle correctly events for SVG.
I wonder whether bs-d3 would be useful. (I’ve used d3, but not with OCaml, and I don’t know anything about this library.)
I’ve written interactive SVGs with js_of_ocaml+tyxml in the past. Events worked just fine. What is the problem exactly?
@mars0i As the author of the bs-d3 bindings, I can say they’re in a pretty limited state at present, and interactivity isn’t really supported yet. That said, it’s pretty easy to add new bindings, so it still might work as a jumping-off point
I’d like to attach actions to some key events much like in the same manner as
but it seems that the part
Html.document##.onkeydown := <...>
cannot simply be translated to SVG. And Merlin is not doing magic helping me to find the correct members.
Can the code be published? Would you happen to have a code snippet of the plumbing of the document events?
The binding is done on the d3 lib, not on the DOM. I’m not sure that this is appliable without d3.