adobe-webplatform / Snap.svg

The JavaScript library for modern SVG graphics.
http://snapsvg.io
Apache License 2.0
13.94k stars 1.15k forks source link

Touch Events #386

Open Siyfion opened 9 years ago

Siyfion commented 9 years ago

I can see here: https://github.com/adobe-webplatform/Snap.svg/blob/af278d50b57d30eb8196593f8551217018d61283/src/mouse.js#L17-27

that there is a map for changing touch events into mouse events, but I'm a little confused as to how to enable this functionality and if it's "officially" supported / maintained?

ibrierley commented 9 years ago

What are you trying to do that isn't in the docs out of interest, ie circle.touchstart() ?

Siyfion commented 9 years ago

@ibrierley I'd like to get http://snapsvg.io/docs/#Element.drag working with touch events.

ibrierley commented 9 years ago

Good question, not tried that. Some drags may already work, but I suspect maybe some browsers won't work with it as is.

Would be interesting to know others experiences. I have got Hammer.js working with Snap for similar stuff which may be of use if there are no better suggestions.

Which browser are you testing out of interest which isn't working ?

Siyfion commented 9 years ago

Just testing it out using the Safari version in the latest iOS release on the iPad / iPhone. It seems that supportsTouch is a flag that can be set, but I just don't know how...?

ibrierley commented 9 years ago

I think the idea is that it should be enabled, if the browser supports it (ie it will contain createTouch in the main document). I think its probably similar to here in Raphael...question maybe whether the browsers support it ? I don't know this, just guessing from code and comments.

https://github.com/DmitryBaranovskiy/raphael/issues/387