xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: limiting panning
Date Thu, 19 Apr 2007 10:08:13 GMT
Hi Leo,

Leo Lim <leo.lim.osv@fedex.com> wrote on 04/13/2007 05:51:56 PM:

> I?m trying to restrict image panning when an svg image?s bounds are 
exceeded.
> Don?t want the user to pan further than this to the point that white
> space ends up being visible.
> Is there a way to do this? (Found some posts regarding overriding 
> the setRenderingTransform but I have no clue how to proceed).

   The 'setRenderingTransform' method is what updates the 
mapping of the SVG canvas to the screen.  So if you intercept
the AffineTransform and adjust the translate component you can 
limit the canvas from rendering anything outside of a particular
region.  You may also need to limit scale.

   As for how the limiting should be done, that is much trickier.
You will need to combine the ViewingTransform 
(JSVGCanvas.getViewingTransform) with the new Rendering Transform.
Then you can project the end points of the rectangle you want to
restrict panning to through the AffineTransform.  This will tell
you what you would get if you applied the Rendering Transform.
You can then adjust the RenderingTransform accordingly (limit
scale so projected w/h is less than canvas w/h, adjust translate
so the corners are within 0,0 and w/h). 


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


Mime
View raw message