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 philip zuniga <ph...@gmail.com> on 2006/05/11 17:14:56 UTC

Some questions on the JSVGScrollPane

Hello there,

A few days ago, I asked how I would be able to set the value of the scroll
to a certain value, and Thomas (the ever dependeble one), told me that I
should use the affine transform of the canvas, so, I added the following
codes,


(x is the value i want for the canvas)

AffineTransform at = canvas.getRenderingTransform();
AffineTransform t = AffineTransform.getTranslateInstance(x, 0);
t.concatenate( at );
canvas.setRenderingTransform( t );

  and, ofcourse, what happened is that my canvas got translated x units, but
the scroll remained in its position. How would I make the horzontal scroll
to move to the value x?

And another one, my Boss, wants me to create a functionality where I would
zoom the JSVGCanvas ( I also use the process similar above), but he want me
to keep some of the SVG items in the canvas to remain static (not affected
by zooming), is this possible?



Thanks a lot for your replies

Philip Zuniga

Re: Some questions on the JSVGScrollPane

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Mon, 2006-05-15 at 22:37 +0800, philip zuniga wrote:
> Hello, 
> what I did was to place everything i want to zoom inside a <g> group,
> and then scaled on the group. I would want to use the process
> suggested by Tonny, that I compute the offsets ( since the <g> is
> moving when I scale it, and I want it to stay at a certain place while
> I am scaling it). My question  is what attributes of <g> should I play
> with so that I could keep <g> on a certain place
 
I think you could use the transform attribute of <g>, especially the
translate transform. Do not change the scale transform since it have
effect on the zoom you created.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: Some questions on the JSVGScrollPane

Posted by philip zuniga <ph...@gmail.com>.
Hello,
what I did was to place everything i want to zoom inside a <g> group, and
then scaled on the group. I would want to use the process suggested by
Tonny, that I compute the offsets ( since the <g> is moving when I scale it,
and I want it to stay at a certain place while I am scaling it). My
question  is what attributes of <g> should I play with so that I could keep
<g> on a certain place

Thanks for all your replies, they're really efficient.

Philip


On 5/15/06, Tonny Kohar <to...@kiyut.com> wrote:
>
> Hi,
>
> On Mon, 2006-05-15 at 12:47 +0800, philip zuniga wrote:
> > Yes, they were both good suggestions. the next question is when I zoom
> > the canvas, the objects that i want to remain static are not affected
> > by the zooming but, they move, this is caused by the zooming of the
> > canvas, but how would I offset the movement of the items?
> >
> > Philip
>
> Assuming the initial transform is identity transform, just calculate the
> offset using identity transform as base. eg:
> - calculate the x,y of upperleft coord against initial transform
> - zoom
> - calculate the x,y of upperleft coord against zoom transform
> - calculate the diff or offset of x,y before and after zoom
>
> Regards
> Tonny Kohar
> --
> Sketsa
> SVG Graphics Editor
> http://www.kiyut.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

Re: Some questions on the JSVGScrollPane

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Mon, 2006-05-15 at 12:47 +0800, philip zuniga wrote:
> Yes, they were both good suggestions. the next question is when I zoom
> the canvas, the objects that i want to remain static are not affected
> by the zooming but, they move, this is caused by the zooming of the
> canvas, but how would I offset the movement of the items?
>  
> Philip

Assuming the initial transform is identity transform, just calculate the
offset using identity transform as base. eg:
- calculate the x,y of upperleft coord against initial transform
- zoom
- calculate the x,y of upperleft coord against zoom transform
- calculate the diff or offset of x,y before and after zoom

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: Some questions on the JSVGScrollPane

Posted by philip zuniga <ph...@gmail.com>.
Yes, they were both good suggestions. the next question is when I zoom the
canvas, the objects that i want to remain static are not affected by the
zooming but, they move, this is caused by the zooming of the canvas, but how
would I offset the movement of the items?

Philip


On 5/13/06, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
> Hi Philip,
>
> "philip zuniga" <ph...@gmail.com> wrote on 05/11/2006 11:14:56 AM:
>
> > A few days ago, I asked how I would be able to set the value of the
> scroll to
> > a certain value, and Thomas (the ever dependeble one), told me that I
> should
> > use the affine transform of the canvas, so, I added the following codes,
>
> >
> > (x is the value i want for the canvas)
> > AffineTransform at = canvas.getRenderingTransform();
> > AffineTransform t = AffineTransform.getTranslateInstance(x, 0);
> > t.concatenate( at );
> > canvas.setRenderingTransform( t );
> >   and, ofcourse, what happened is that my canvas got translated x units,
> but
> > the scroll remained in its position. How would I make the horzontal
> scroll to
> > move to the value x?
>
>   It should have moved when the canvas moved. It listens for
> GvtRenderingCompleted events (fired when the rendering transform changes)
> and recalculates it's scrollbar positions.
>
> > And another one, my Boss, wants me to create a functionality where I
> would
> > zoom the JSVGCanvas ( I also use the process similar above), but he want
> me to
> > keep some of the SVG items in the canvas to remain static (not affected
> by
> > zooming), is this possible?
>
>   Steiner's answer on this is a pretty good one.
>   The other option is to put the zoomy bits in a group
> or SVG element and adjust the transform on that group/svg
> element rather than adjusting the canvas's rendering transform...
> Of course you loose the JSVGScrollPane that way.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

Re: Some questions on the JSVGScrollPane

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

"philip zuniga" <ph...@gmail.com> wrote on 05/11/2006 11:14:56 AM:

> A few days ago, I asked how I would be able to set the value of the 
scroll to 
> a certain value, and Thomas (the ever dependeble one), told me that I 
should 
> use the affine transform of the canvas, so, I added the following codes, 

> 
> (x is the value i want for the canvas)
> AffineTransform at = canvas.getRenderingTransform();
> AffineTransform t = AffineTransform.getTranslateInstance(x, 0);
> t.concatenate( at );
> canvas.setRenderingTransform( t );
>   and, ofcourse, what happened is that my canvas got translated x units, 
but 
> the scroll remained in its position. How would I make the horzontal 
scroll to 
> move to the value x?

   It should have moved when the canvas moved. It listens for 
GvtRenderingCompleted events (fired when the rendering transform changes)
and recalculates it's scrollbar positions.

> And another one, my Boss, wants me to create a functionality where I 
would 
> zoom the JSVGCanvas ( I also use the process similar above), but he want 
me to
> keep some of the SVG items in the canvas to remain static (not affected 
by 
> zooming), is this possible? 

   Steiner's answer on this is a pretty good one.
   The other option is to put the zoomy bits in a group
or SVG element and adjust the transform on that group/svg
element rather than adjusting the canvas's rendering transform...
Of course you loose the JSVGScrollPane that way.



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