After further investigation, it seems like I need to call 
the "getTransformToElement"-method - which isn't available in v3.0 
of the Adobe plugin. Requiering Adobe 6.0 beta isn't an option. So 
what calculations does getTransformToElement do? Is there some way 
that I can create my own getTransformToElement-method?

// Henric

--- In svg-developers@yahoogroups.com, "phre4kerz" <[EMAIL PROTECTED]> wrote:
> I have an application that loads an SVG, then enables the editing 
of 
> the properties of several of the SVG-elements.
> 
> When I want to edit the x and Y-properties of for example a tspan-
> object I get a problem.
> In the XML, the tspan-object has an x-value of 20, and a y-value 
of 20.
> 
> When I call getBBox() I get x: -48.5  y: -26.015
> 
> Then I call getCTM() and transform the BBox-values to the correct 
> coordinates on the screen: x: 151.5  y: 40.89. These values are 
the 
> ones that I send out to the user for editing.
> 
> Now to the problem: I don't know how to count backwards and make 
151.5 
> and 40.89 become 20 again. By inverting the CTM-matrix I can go 
from 
> x: 151.5 and y: 40.89 to x: -48.5 and y: -26.015 but I have no 
idea 
> how to go from those numbers to 20.
> 
> 
> 
> //One of the text/tspan-objects I'm trying to modify:
> 
> <text id="text100" transform="matrix(1 0 0 1 200 66.9043)" 
> startOffset="0"><tspan x="20" y="20" fill="#C40009" font-
> family="'HelveticaNeue-Roman'" font-size="64" style="text-anchor: 
> end">35</tspan></text>
> 
> // Messy code to go from BBox-coordinates to Screen-coordinates:
> 
> PositionControl.prototype.getRealPosition = function(obj, 
dimension, 
> decimals)
> {
> 
>       if (decimals == null) decimals = 0;
> 
>       // Get the bounding-box of the object
>       bbox = obj.getBBox();
>       // Get the transformation-matrix of the object
>       var ctmmatrix = obj.getCTM();
>       
>       // An SVGPoint-variable
>       var windowPoint = svgDocument.documentElement.createSVGPoint
();
>       // Set the svgPoints variables to that of the bounding-box x 
> and y-coord
>       windowPoint.x = bbox.x;
>       windowPoint.y = bbox.y;
>       // Transform the point with the objects CTM-matrix
>       var viewBoxPoint = windowPoint.matrixTransform(ctmmatrix);
> 
>       // round the numbers
>       var z = Math.pow(10, decimals);
> 
>       // Return the transformed values
>       if (dimension == "x")
>               return Math.round(viewBoxPoint.x * z)/z;
>       else if (dimension == "y")
>               return Math.round(viewBoxPoint.y * z)/z;
>       else
>               return 0;
> }





-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-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/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

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



Reply via email to