Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tap and double tap event in d3.js force directed graph

I am working on a force directed graph using d3.js. I need to handle tap and double tap event on nodes for mobile devices. Mouseover and click functions need to replicated as tap and double tap in d3.js. I have managed to get a touch event working but have no clue on how to capture double tap event in a mobile device.

like image 937
Rahul Rout Avatar asked Aug 10 '12 04:08

Rahul Rout


1 Answers

D3 has the touches event and using this you can get touch position coordinates from inside your event handler, but this doesn't give you any special handling for or help identify long press and doubletap. You can add support for long press and double tap yourself. For long press, have a look at this example:

Long Press in JavaScript?

If you're using jQuery, there are doubletap plugins like this one:

jQuery doubletap plugin

like image 65
Mark Roper Avatar answered Sep 19 '22 19:09

Mark Roper