Hi,
you'd better use the transform property of the SVG DOM elements.
Here is a little function to get the angle properly : 
http://jsbin.com/usopay/edit#javascript,html
Yannick

----- Mail original -----
De: "svgdeveloper" <svgdevelo...@yahoo.com>
À: svg-developers@yahoogroups.com
Envoyé: Dimanche 20 Mai 2012 13:41:11
Objet: [svg-developers] Get first parameter of rotate function






Hello, 

I just joined your SVG group. I'm working on a web application which is based 
on SVG. I have a little problem concerning the rotate parameters of a text 
element. I want to fetch the first parameter of a rotate function which 
represents the rotation angle in degrees. 

I use the jQuery SVG plugin of Keith Wood to use jQuery to interact with the 
SVG canvas. To fetch the angle I use the indexOf and substring methods of 
JavaScript. For instance: 

currentFontRotation = currentId.attr('transform'); 
var bracket = currentFontRotation.indexOf('rotate('); 
var comma = currentFontRotation.indexOf(','); 
bracket = bracket +7; 
currentFontRotationNumber = currentFontRotation.substring(bracket, comma ); 

The variable currentId represents the selected text element. Is there a more 
clean way to get the angle. I think it's a pretty dirty method to use the 
indexOf and substring methods in this case. 

Thanks 





------------------------------------

-----
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    svg-developers-dig...@yahoogroups.com 
    svg-developers-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to