Hi Hardcod3r,

hardc0d3r <[EMAIL PROTECTED]> wrote on 07/18/2007 12:36:53 PM:

> can i just set the affinetransform scale?

   With Affine Transforms the scale and the translate interact.
So in short no you can't.

> i tried to limit zooming by using the setToScale.. i was kinda 
> successful but when zooming is beyond the limit, the svg is 
> always set to the upper left corner.. 

   That is because AffineTransform.setToScale changes the transform
to be just a scaling transform with no translate.

> how do i set it on the point where it was zoomed? 

   If you have the point in screen space.  The easiest thing
to do is map that point through the inverse of the Rendering 
Transform.  This will give you the point in the source 
coordinate system of the Rendering Transform.

   Then you can map that point back to 0,0 with a
translate transform:

     Tx = AffineTransform.getTranslateInstance(-ptx, -pty);

   Combine that with your limited scale:
        Tx.preConcatenate(AffineTransform.getScaleInstance(scale, scale));

   Then Translate that back to the middle of the screen:
        Tx.preConcatenate(AffineTransform.getTranslateInstance
                          (canvasSize.width/2, canvasSize.height/2)); 


> and off topic question.. can i just use
> translate to limit panning? if yes, how do i limit panning while 
dragging
> (even when dragged, it will not go over the bounds of the svg)?

   You need to limit the translate in the painting transform.
You can do that be overriding 
        setPaintingTransform(AffineTransform at).

   Or you can implement your own version of the pan/zoom
interactors and disable the built in ones.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to