简体   繁体   中英

D3 mouse events touch events i.e. click -> supported touch event

I have been looking for examples for using D3 on a mobile device with touch events instead of mouse events, but am struggling to find anything that maps what touch event replaces which mouse event for example, a click or dblclick . Thus, I have struggled to get started on "converting" my D3 visualizations to support touch.

I need appropriate touch events for:

  • Zooming (or will it work for both?): var zoomed = d3.behavior.zoom().x(x).y(y).scaleExtent([scaleExtentMin, scaleExtentMax]).on("zoom", partitionZoom);
  • click
  • dblclick

So the main conversion I would need is click --> supported touch event.

How can I do this with D3? Or is there an alternative library that would work well with D3 that can handle the touch events?

Any help with this would be appreciated!

what ever event is supported by html containers is supported by svg. click and tap events are the same except for the 300ms delay. you can use hammer like previously suggested or just jquery mobile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM