xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Zoom In/Zoom Out problem for glass pane
Date Thu, 04 May 2006 11:48:23 GMT
Hi Selva,

news <news@sea.gmane.org> wrote on 05/04/2006 02:59:27 AM:

> > I added a component listener to the JSVGCanvas to catch resize events
> > so I can adjust the background to exactly fill the window.   You can
> > probably use the same code to adjust your transparent glass pane:
> I have added your code in UpdateManagerListener's updateCompleted(). 
Because i 
> should resize the glass pane while doing zoom in/zoom out. But doing 
zoom in 
> glass pane resized properly. But in zoom out, viewport is not in left 
> of the SVGCanvas, it means Xmin and Ymin value is not (0,0).

   Correct typically on zoom out the upper left of the canvas 
will be negative X/Y.  Some of the stuff in Roger's code to
calculate the view port looks a little off to me.  First I would
have used the rectangle returned by canvas.getRenderRect().  IIRC
there are some problems with getVisibleRect().

   Second the code uses:
        final float width = (float)coords[6];
        final float height = (float)coords[7];

   I think this should be:
        final float width  = (float)(coords[6]-coords[4]);
        final float height = (float)(coords[7]-coords[5]);

   Finally for a glass pane it more or less doesn't 'cost' you
anything to make it _huge_ so often I'll just set it's bounds ridiculously
large and not worry about it:
        <rext visibility="hidden" pointer-events="fill" fill="none"
              x="-1000%" y="-1000%" width="3000%" height="3000%"/>

   Heck use 10,000% if you want (comma included for readability you can't 
that in the real attribute).

> it's coming center of the SVGCanvas. Can you please explain why it is 
> happening like this?
> also is it possible to change the ViewPort's size and position 

   You can change the viewBox on the root SVG element if you want but
this is a _very_ expensive operation as we rebuild the entire graphics
tree when the width/height of this changes so that element's using '%' 
units are sized correctly...

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

View raw message