text:wrap not working when created dynamically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike

    text:wrap not working when created dynamically

    I have a script that is not rendering the textwrap in svg properly.
    //does not work .....
    var svgLand = svgObj.getEleme ntById("NarrDis play");
    mytextwrap=
    document.create Element("text:w rap"); mytextwrap.setA ttribute("x","2 0");
    mytextwrap.setA ttribute("y","3 0");
    mytextwrap.setA ttribute("width ","640");
    mytextwrap.setA ttribute("style ","fill:#000000 ; font-family:arial;
    font-size:14; text-align:left; line-interval:1.25em ;");
    mytext=document .createTextNode ("something here");
    mytextwrap.appe ndChild(mytext) ;
    svgLand.appendC hild(mytextwrap );


    //works ....
    mynorm_text = document.create Element("text") ;
    mynorm_text.set Attribute("x"," 30");
    mynorm_text.set Attribute("y"," 90");
    mynorm_text.set Attribute("styl e","fill:#00000 0; font-family:arial;
    font-size:14; text-align:left;");
    mytext=document .createTextNode ("something here");
    mynorm_text.app endChild(mytext );
    svgLand.appendC hild(mynorm_tex t);

    It works when I use this statically:
    <text:wrap id="NarrText" x="20" y="30" width="640" style="fill:#00 0000;
    font-family:arial; font-size:14; text-align:left;
    line-interval:1.25em ;">default text</text:wrap>

    Any help appreciated.

    Mike

  • Randy Webb

    #2
    Re: text:wrap not working when created dynamically

    mike said the following on 7/24/2005 11:20 AM:
    [color=blue]
    > I have a script that is not rendering the textwrap in svg properly.
    > //does not work .....
    > var svgLand = svgObj.getEleme ntById("NarrDis play");
    > mytextwrap=
    > document.create Element("text:w rap");[/color]
    [color=blue]
    > mytextwrap.setA ttribute("x","2 0");[/color]


    mytextwrap.x = "20";
    [color=blue]
    > mytextwrap.setA ttribute("y","3 0");[/color]

    mytextwrap.y = "30";

    And so on. Meaning, don't use setAttribute, just set the properties
    directly.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly

    Comment

    • mike

      #3
      Re: text:wrap not working when created dynamically

      No change ........ same thing...... does not work.

      Comment

      • mike

        #4
        Re: text:wrap not working when created dynamically

        I got it. textwrap.es has some functions with the object.

        So after i created the static textwrap instance:

        <text:wrap id="NarrText" x="20" y="30" width="640" style="fill:#00 0000;

        font-family:arial; font-size:14; text-align:left;
        line-interval:1.25em ;">default text</text:wrap>

        I can use:
        var text = TextWrap._insta nces[0];
        text.setString( task_text);

        and it will change the text.

        see textwrap.es

        Mike

        Comment

        Working...