On Fri, 6 May 2005, Maik Schürer wrote:
>> Simply transform the viewPort to the outermost SVG element's
>> coordinate system by using the inverse of the screen CTM for the
>> outermost SVG element.
> I don't understand that
> what is "the inverse of the screen CTM" ?
> Maik
Maik, check out the "Drag" example in the SVG wiki. It uses the CTM to get
the inverse transformation as part of what it does. Your question suggests
you don't understand how matrix multiplication is used to convert from SVG
coordinates to screen (window) coordinates. In an abstract schematic form,
it looks like this ...
screencoords = CTM * SVGcoords
so
screencoords * (1/CTM) = SVGcoords
and 1/CTM is the matrix inverse of the CTM matrix. With this matrix, you
can figure out what the SVG coordinates are of the screen coordinate
(0,0), and similarly find the other corner. Those two points (in SVG
coords) should be the points you're looking for. Make sense?
 brian johnson, dept of architecture, university of washington
>
> Thomas DeWeese schrieb:
>> Maik Schürer wrote:
>>
>>> Hi Thomas,
>>> I have not found a solution for my problem up to now.
>>>
>>> >In what coordinate system?
>>> in SVG document coordinate system
>>> further in text I mean with 'coordinates' always the SVG document
>>> coordinate system
>>>
>>> > You probably want to look at things like 'getScreenCTM' ...
>>> for my problem it is not necessarry to convert to screen coordinates
>>
>>
>> No you want to convert _from_ screen coordinates.
>>
>>> > 'getViewPort()' ...
>>> when I debug the viewPort of the rootElement I always get X/Y = 0/0 and
>>> width and height of the current canvas  independ on viewing the complete
>>> document or zoomed in a part of it !? Is this correct or did I something
>>> wrong ?
>>
>>
>> It is correct because the viewPort is (at least for the canvas) in
>> screen coordinates. So unless you resize the canvas it should stay the
>> same when you zoom/pan. But the screen CTM will change for the SVG
>> element.
>>
>>> When I zoomed in, I expected to found X/Y > 0 and width/height smaller
>>> than my documents width/height...
>>>
>>> I try to describe my problem by an example:
>>>  my SVG is 2000x1000px
>>>  I zoomed in, so now I see a part of the document starting on
>>> 600px/200px, 1000px wide and 500px high
>>>  now I want to get these values: 600, 200, 1000 and 500, to know what is
>>> the currently visible part of the document...
>>> (all coordinates in SVG document coordinate system)
>>
>>
>> Simply transform the viewPort to the outermost SVG element's
>> coordinate system by using the inverse of the screen CTM for the
>> outermost SVG element.
>>
>
>
> 
> To unsubscribe, email: batikusersunsubscribe@xmlgraphics.apache.org
> For additional commands, email: batikusershelp@xmlgraphics.apache.org
>
>
