Hey Marios,
Try something like this
1. assign JButton to action that sets and unsets
boolean doZoom;
2. extend class
abstract class Zoomer extends AbstractZoomInteractor(){
...
...
// end interaction defines the condition to end the zoom
public boolean endInteraction()
{
return finished;
}
// I want the zoom to end at the release of my mouse, but you
can do it anywhere else
public void mouseReleased( MouseEvent e ){
super(e);
finished = true;
}
}
3. Create instance of zoomInteractor
Interactor zoomInteractor = new Zoomer()
{
boolean finished = false;
public boolean startInteraction(InputEvent ie)
{
return doZoom;
}
};
4. Attach interactor
svgCanvas.getInteractors().add( zoomInteactor );
That's what I did and it seems to work. You can probably try something else
as well.
cheers,
-tomas
----- Original Message -----
From: Marios Depountis
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, July 08, 2003 12:27 AM
Subject: Re: JSVGCanvas ZoomIn Action problem.
Thank you very much your advice was very helpful.But what I have not managed
to do yet is how can I ovewrite the AbstractZoomInteractor in order to add
the functionality of zoom in a particular button or menuItem(for example a
jbutton of my application). Is there any way that I can an action event
instead of an input event in the class that extends AbstractZoomInteractor?
Should I overwrite the startInteraction( InputEvent ie ) method or just
define it
Thank you in advance
Marios
>By default, the zoom Interactor is bound to Ctrl-Mouse Button 1.
>You can turn this on and off with the call
>JSVGCanvas.setEnableZoomInteractor(boolean b)
>If you want to write your own, take a look at the way
>org.apache.batik.swing.gvt.AbstractZoomInteractor is invoked in the
>JSVGCanvas,
>Basically you need to provide a Interactor class that extends the
>AbstractZoomInteractor, define the
>startInteraction( InputEvent ie ) method, and add an instance of it to the
>canvas
>JSVGCanvas.getInteractors.add( < new Instance > );
>Anything fancier than the default interactor can be created by either
>writing your own interactor or extending the AbstractZoomInteractor class.
>You might want to look at both zoomInteractor and ImageZoomInteractor, one
>is a real time zoom, the other allows you to lasso an area to zoom in.
>-tomas
----- Original Message -----
From: Marios Depountis
To: [EMAIL PROTECTED]
Sent: Saturday, July 05, 2003 8:14 PM
Subject: JSVGCanvas ZoomIn Action problem.
Hi,
I am trying to use the zoom in capability of JSVGCanvas but I cannot access
the protected class. Furthermore I tried to override the protected class but
still I could not make it work.
Could you please tell me how can I use the zoom capabilites of JSVGCanvas?
(If it easy send me some code) How can I access the class and how can I use
it?
Thanks in advance
Marios
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]