You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Luc_B <lu...@gmail.com> on 2009/05/08 22:04:03 UTC

Zoom Extents for an specific element (rectangle)

Hello all,

I have been trying to figure out this one for days. I have several 
rectangles tile into the svg document.
These elements all have and id. How can I do a zoom a specific rectangle to
its maximum extent. 

I have tried to get the BBox of the SVGLocatable element but where I set the
viewBox attr of the svg document is does not bring me to the right
rectangle?

I would prefer not to alter the svg do and just a AffineTransform. 

Long question short: How to I zoom to absolute coordinates (not Screen
coords)?

Thanks so much,
Luc



-- 
View this message in context: http://www.nabble.com/Zoom-Extents-for-an-specific-element-%28rectangle%29-tp23452005p23452005.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Zoom Extents for an specific element (rectangle)

Posted by Helder Magalhães <he...@gmail.com>.
Hi Luc,


> I have been trying to figure out this one for days. I have several
> rectangles tile into the svg document.
> These elements all have and id. How can I do a zoom a specific rectangle to
> its maximum extent.

Humm... Somehow related, you may consider taking a look at the SVG
view [1] concept. There's (at least) a sample [2] within Batik and a
few more (search for the "linking-frag-XXX-t" ones) within the SVG
Test Suite [3]. ;-)


> I have tried to get the BBox of the SVGLocatable element but where I set the
> viewBox attr of the svg document is does not bring me to the right
> rectangle?
[... Taken from below:]
> Long question short: How to I zoom to absolute coordinates (not Screen
> coords)?

Well, there's getCTM (user coordinates) and getScreenCTM (screen
coordinates) [4] which can hint towards the needed coordinate
transform (usually an inverted transform based on the current one) in
order to get the desired result. :-)

You may also take a look at a sample [5] which illustrates something
related: drag and drop which works well (in terms of screen
coordinates behavior) independently from canvas size and zoom/pan. ;-)


> I would prefer not to alter the svg do and just a AffineTransform.

Yes, I'm sure this will be feasible. I recall a few related threads
within the past few months.


> Thanks so much,
> Luc

Hope this helps,
 Helder Magalhães


[1] http://www.w3.org/TR/SVGTiny12/linking.html#LinksIntoSVG
[2] samples/tests/spec/linking/linkingViewBox.svg (shipped with Batik
release or from a SVN checkout)
[3] http://www.w3.org/Graphics/SVG/Test/20080912/
[4] http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/dom/svg/SVGOMTextElement.html
[5] http://www.codedread.com/code.php#dragsvg

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Zoom Extents for an specific element (rectangle)

Posted by Luc_B <lu...@gmail.com>.
Hi thanks for your answer.

I was looking at this thread but I can`t seem to make it work... There must
be something I don`t understand. here is the URL:
http://markmail.org/message/5ywr346fjyel7udc#query:zooming%20to%20absolute%20coordinates+page:1+mid:tuhquj7tfvuavqyt+state:results
http://markmail.org/message/5ywr346fjyel7udc#query:zooming%20to%20absolute%20coordinates+page:1+mid:tuhquj7tfvuavqyt+state:results 


Luc_B wrote:
> 
> Hello all,
> 
> I have been trying to figure out this one for days. I have several 
> rectangles tile into the svg document.
> These elements all have and id. How can I do a zoom a specific rectangle
> to its maximum extent. 
> 
> I have tried to get the BBox of the SVGLocatable element but where I set
> the viewBox attr of the svg document is does not bring me to the right
> rectangle?
> 
> I would prefer not to alter the svg do and just a AffineTransform. 
> 
> Long question short: How to I zoom to absolute coordinates (not Screen
> coords)?
> 
> Thanks so much,
> Luc
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Zoom-Extents-for-an-specific-element-%28rectangle%29-tp23452005p23483578.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org