Date: 2005-02-17T10:49:33
   Editor: JamesShaw
   Wiki: XML Graphics - Batik Wiki
   Page: CanvasInteractors
   URL: http://wiki.apache.org/xmlgraphics-batik/CanvasInteractors

   no comment

New Page:

The following default mouse interactions can be performed on a JSVGCanvas:
  *  Shift+LeftButton - Pan
  *  Ctrl+LeftButton - Zoom Box
  *  Shift+RightButton - Zoom (with instant feedback)
  *  Ctrl+RightButton - Rotate

You can enable or disable these interactors by using the 
[http://xml.apache.org/batik/javadoc/org/apache/batik/swing/JSVGCanvas.html 
setEnable*Interactor()] methods of JSVGCanvas.

To add your own interactors, create an Interactor instance, possibly by 
extending one of the {{{org.apache.batik.swing.gvt.Abstract*Interactor}}} 
classes.

For example:
{{{
private Interactor panInteractor = new AbstractPanInteractor() {
    public boolean startInteraction(InputEvent ie) {
        int mods = ie.getModifiers();
        return ie.getID() == MouseEvent.MOUSE_PRESSED &&
            (mods & InputEvent.BUTTON1_MASK) != 0;
    }
};
}}}
Then invoke {{{canvas.getInteractors().add(panInteractor)}}} to add your 
interactor to the canvas' interactor list.

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

Reply via email to