Wednesday, February 26, 2014

Re: GWT and SVG, the 125th... :-)

Hi,

I have a minimal example now, see below.
I included the JS code as a ClientBundle and also called injectScript:

public class SampleLoader
{
 public void injectScript()
 {
         String raw = SampleAssetsBundle.instance.myScript().getText();
         ScriptElement e = Document.get().createScriptElement();
         e.setText(raw);
         Document.get().getBody().appendChild(e);
 }
}

To test it, I use this method:

private static native Element testSVG ()
 /*-{
 var draw = SVG('drawing')
 
 var text = draw.text('SVG.JS').move(300, 0)
        text.font({
          family: 'Source Sans Pro'
        , size: 180
        , anchor: 'middle'
        , leading: 1
        })

 return (draw);  
 }-*/; 

But when call testSVG I get the following error:
com.google.gwt.core.client.JavaScriptException: (ReferenceError) @wgp.client.lib.GraphicsPanel::test()([]): SVG is not defined

When looking at the svg library (http://svgjs.com/), the method "SVG" should be included, but I cannot find it within the JS file.

So I actually don't know if it is not found for some reason, or doesn't exist or whatever.

What can I do next?

Thanks
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+unsubscribe@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.

No comments:

Post a Comment