xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xml-batik-...@apache.org
Subject [XML Graphics - Batik Wiki] New: CanvasInteractors
Date Thu, 17 Feb 2005 18:49:33 GMT
   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


Mime
View raw message