Hi,

I am currently testing two SVG libraries for use within my GWT application:


   - SVGJS (http://svgjs.com)
   - SnapSVG (http://snapsvg.io)

The first one, SVGJS, is now working for me, following a good 
explanation<https://groups.google.com/d/msg/google-web-toolkit/JmJDMdZKVH0/GsjR6CSmkKIJ>in
 this group (thanks to Jens).
The basic idea is to pass an existing DOM element as a container to a JSNI 
method, which in turn passes this element to the library's SVG constructor:

private native void drawExample(Element container) /*-{      var draw = 
SVG(container)      draw.text('SVG.JS')    }-*/;



This approach did not work for me with the other library, SnapSVG.
When I do exactly the same:

private native void drawExample(Element container) /*-{      var s = 
Snap(container);      var c = s.circle(150,150,150);    }-*/;


Then I get the JavaScript error:

"Object [object Object] has no method 'circle'"


I assume that there is no suitable constructor so that s is null.

When I do this:

private native void drawExample(Element container) /*-{      var s = 
Snap(400,400);      var c = s.circle(150,150,150);      
container.appendChild(s);    }-*/;


Then I get the error:

"An attempt was made to reference a Node in a context where it does not 
exist."


Note that I am testing within a DialogBox and passing its getElement() as 
container to the method above.

How can you connect the generated SVG object to a widget within a DialogBox?

Thank you
Magnus

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to