Marios Depountis wrote:

Hi Tomas,
First of all I want to thank for all your help. I followed exactly the steps you have proposed to me but I still have not managed to make it work properly. When I render the DOM object in my Canvas all the capabilities of JSVGCanvas exist, so what I want to do is to add the zoom functionality only when my JButton for zoom is pressed.

The Interactors are ment for 'interactive' operations (like the pan or the 'interactive' zoom), if you want to
have a default zoom happen when the user presses a button you should use Actions. The JSVGCanvas
provides a good set of default actions:


Action a = (Action)canvas.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION);

JButton button = new JButton(a);

What I changed is if you don't like the default action you can now create your own actions.

I created the following class:The super call inside the mouseReleased method cannot be compiled(Do you have any idea why this may happen?)

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, can do it anywhere else
public void mouseReleased( MouseEvent e )
{
//super(e);
finished = true;
System.out.println("finished"+finished);
}
Then in the constructor of my class(where JSVGCanvas is defined) the zoom interactor.
zoomAInteractor =
new Zoomer(){ boolean finished = false;
public bo! olean startInteraction(InputEvent ie)
{
return doZoom;
}};
svgCanvas.getInteractors().add(zoomAInteractor);
Any time I click my JButton I make doZoom=true but when the mouse is released the zoom doesn't stop. I have checked that the code never access the mouseReleased method. Furthermore I cannot stop the zoom after presing another button that makes the variable doZoom=false.
Have you any idea about what am I doing wrong?
Thanks a lot
Marios
------------------------------------------------------------------------
Do you Yahoo!?
SBC Yahoo! DSL <http://pa.yahoo.com/*http://rd.yahoo.com/evt=1207/*http://promo.yahoo.com/sbc/> - Now only $29.95 per month!





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



Reply via email to