简体   繁体   English

D3鼠标事件触摸事件,即单击->支持的触摸事件

[英]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 . 我一直在寻找在具有触摸事件而不是鼠标事件的移动设备上使用D3的示例,但是我一直在努力寻找能够映射出什么触摸事件替代了哪个鼠标事件的任何东西,例如clickdblclick Thus, I have struggled to get started on "converting" my D3 visualizations to support touch. 因此,我一直难以开始“转换”我的D3可视化以支持触摸。

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); 缩放(或对两者都适用?): 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. 因此,我需要的主要转换是click ->支持的触摸事件。

How can I do this with D3? 如何使用D3做到这一点? Or is there an alternative library that would work well with D3 that can handle the touch events? 还是有一个替代库可以与D3一起很好地处理触摸事件?

Any help with this would be appreciated! 任何帮助,将不胜感激!

what ever event is supported by html containers is supported by svg. svg支持html容器支持的所有事件。 click and tap events are the same except for the 300ms delay. 除了300ms的延迟外,click和tap事件是相同的。 you can use hammer like previously suggested or just jquery mobile 您可以像以前建议的那样使用锤子,或者只是使用jQuery mobile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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