You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by xm...@apache.org on 2005/02/17 19:49:33 UTC

[XML Graphics - Batik Wiki] New: CanvasInteractors

   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: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org