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 Ruben Fonseca <ru...@di.uminho.pt> on 2007/04/12 16:45:50 UTC

Center and AutoSizing SVG on JSVGCanvas

Hi!

I'm using Batik library to display a SVG image on a Java program, using
the JSVGCanvas widget.

The problem is, when the image is loaded, it goes straight to the top
left corner of the canvas, and stays very little.

I wanted it to appear centered on canvas and auto zoomed with the best
fit possible for the canvas.

Is this possible? I searched on the API and docs with no success.

Thank you :)


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


Re: Center and AutoSizing SVG on JSVGCanvas

Posted by Ruben Fonseca <ru...@di.uminho.pt>.
On Fri, 2007-04-13 at 15:59 +0100, Ruben Fonseca wrote:
> On Fri, 2007-04-13 at 06:21 -0400, thomas.deweese@kodak.com wrote:
> > Hi Ruben,
> > 
> >     The Canvas should fit the content to the window if it has a 'viewBox' 
> > attribute.
> > With out a viewBox attribute the canvas doesn't know what part of the 
> > infinite canvas
> > would be appropriate to scale to the window so it uses the identity 
> > transform.
> 
> It worked like a charm!! THANK YOU!!
> 
> Ruben

Hi! Just a small question:

When I zoom in or out, or pan, the canves is not redraw until I release
the mouse button. Is this behaviour expected? Can I make the canvas to
redrawy everytime there is a change like pan or zooming?

Thank you
Ruben


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


Re: Center and AutoSizing SVG on JSVGCanvas

Posted by Ruben Fonseca <ru...@di.uminho.pt>.
On Fri, 2007-04-13 at 06:21 -0400, thomas.deweese@kodak.com wrote:
> Hi Ruben,
> 
>     The Canvas should fit the content to the window if it has a 'viewBox' 
> attribute.
> With out a viewBox attribute the canvas doesn't know what part of the 
> infinite canvas
> would be appropriate to scale to the window so it uses the identity 
> transform.

It worked like a charm!! THANK YOU!!

Ruben

> 
> Ruben Fonseca <ru...@di.uminho.pt> wrote on 04/12/2007 10:45:50 AM:
> 
> > I'm using Batik library to display a SVG image on a Java program, using
> > the JSVGCanvas widget.
> > 
> > The problem is, when the image is loaded, it goes straight to the top
> > left corner of the canvas, and stays very little.
> > 
> > I wanted it to appear centered on canvas and auto zoomed with the best
> > fit possible for the canvas.
> > 
> > Is this possible? I searched on the API and docs with no success.
> > 
> > Thank you :)
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Re: Center and AutoSizing SVG on JSVGCanvas

Posted by th...@kodak.com.
Hi Ruben,

    The Canvas should fit the content to the window if it has a 'viewBox' 
attribute.
With out a viewBox attribute the canvas doesn't know what part of the 
infinite canvas
would be appropriate to scale to the window so it uses the identity 
transform.

Ruben Fonseca <ru...@di.uminho.pt> wrote on 04/12/2007 10:45:50 AM:

> I'm using Batik library to display a SVG image on a Java program, using
> the JSVGCanvas widget.
> 
> The problem is, when the image is loaded, it goes straight to the top
> left corner of the canvas, and stays very little.
> 
> I wanted it to appear centered on canvas and auto zoomed with the best
> fit possible for the canvas.
> 
> Is this possible? I searched on the API and docs with no success.
> 
> Thank you :)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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