I am launching today lib-gwt-svg 0.5.5. The main highlight of this release is support for touch events. This version also fixes a few bugs and adds minor features I needed for my new project svgreal. The specifics is detailed in the release notes.
With regards to touch event support, here are the main points you should be aware of.
The SVG specification does not officially support touch events in any form (it predates touch events). However a few browser have added touch events to SVG elements, using the following heuristic: anything which supports mouse events also supports touch events. I have taken this approach too and added the four handler registration methods to the these elements: OMSVGAElement, OMSVGAnimationElement, OMSVGCircleElement, OMSVGDefsElement, OMSVGEllipseElement, OMSVGForeignObjectElement, OMSVGGElement, OMSVGImageElement, OMSVGLineElement, OMSVGPathElement, OMSVGPolygonElement, OMSVGPolylineElement, OMSVGRectElement, OMSVGSVGElement, OMSVGSwitchElement, OMSVGSymbolElement, OMSVGTextContentElement, OMSVGUseElement
Adding support for handler registration does not mean that the underlying browser actually supports and fires them. Also keep in mind that a device may support touch events for HTML elements, but not for SVG elements. To test if SVG touch events are supported, I provide a runtime method in the class DOMHelper
Tests made so far indicate the following:
Browser | Support |
---|---|
Firefox mobile 9.x | Ok, but only supports single touch events. True multitouch is planned for 11.x |
Playbook browser | Ok (thanks to Michael Baranov for the tests and support in the implementation) |
Android stock browser | Not working |
I have not tested on iOS devices yet, neither on the new Chrome Android browser. Any information of users on these platforms are welcome !
With regards to gesture events, I have decided to take a cautious approach as they do not seem to gain a lot of traction beyond the iOS world. Low-level support has been added in DOMHelperImpl, but I have not added handler registration method to the APIs. If they get normalized and adopted, I will of course reconsider.
I do not provide a sample for touch events yet. I plan to create a few demos for the next version of lib-gwt-svg.
Leave a Reply