patorjk / d3-context-menu

A plugin for d3.js that allows you to easy use context-menus in your visualizations.
MIT License
140 stars 54 forks source link

Does it support touch devices? #42

Open vijaythummar opened 6 years ago

vijaythummar commented 6 years ago

Can we integrate context menu for touch devices?

patorjk commented 6 years ago

I haven't tested it in touch devices, but it should work on them. Just attach the appearance of the menu to the event you want (see the examples). For example:

.on('contextmenu', d3.contextMenu(menu)); // attach menu to element

That attaches the menu to the right-click event ("contextmenu"). You could change "contextmenu" to "click" and it should cause the menu to appear when the object is clicked/touched.