(You can also use the ActionMap to perform a zoom in...)
I think this is what he wants to do.
Action zoomIn = svgCanvas.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION);
Then use this Action to construct your toolbar button. You can also look in JSVGViewerFrame which does exactly this.
Interactors are useful when you want to put UI over the top of the SVG canvas. If you just want to do a 'fixed' action you are better off not using interactors.
You can try this :
private void zoomInButtonActionPerformed(ActionEvent evt) {
canvas.getInteractors().add(zoomInteractor);
}
/**
* An interactor to perform a zoom.
* <p>Binding: BUTTON1</p>
*/
protected Interactor zoomInteractor = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED;
}
};
It works but perhaps there is a better way to do this.
But you will have to clear all interactors if you want to stop this behaviour
hope this helps
-----Message d'origine----- *De :* Jamie [mailto:[EMAIL PROTECTED] *Envoyé :* vendredi 3 octobre 2003 11:23 *À :* Batik Users *Objet :* Interactors
Forgive me for yet again asking this question: Interactors - what
and how?
Specifically, I am constructing a UI with JSVGCanvas as my main
component. I have a button on the toolbar which I want to use as a
'Zoom In'. When the user fires the event ...
private void zoomInButtonActionPerformed(ActionEvent evt) {
// telll Interactor to Zoom In ??
}
Am I wrong in assuming that interactors can be called like this. Or
do I 'manually' set the viewbox/currentTransform. I vaguely
understand that Interactors are there and work just from the fact I
can use the mouse and CTRL keys to perform actions.
I noted that the Batik guys were giving a presentation at SVG Open
2003 where they explained the use of Interactors. I can view the
abstarct but the presentation does not seem to be available. Is it
available? This would be most useful to me ;-). The documentation
(website/API) is relatively sketchy for an 'absolute beginner'.
------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]