Differences between revisions 3 and 4
Revision 3 as of 2008-11-24 17:55:22
Size: 1078
Comment: Reset transform added (already implemented missing for a while but missing)
Revision 4 as of 2009-09-20 23:47:41
Size: 1080
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
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. 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.

The following default mouse interactions can be performed on a JSVGCanvas:

  • Ctrl+LeftButton - Zoom Box

  • Shift+RightButton - Zoom (with instant feedback)

  • Shift+LeftButton - Pan

  • Ctrl+RightButton - Rotate

  • Ctrl+Shift+RightButton - Reset transform (also known as "Original View")

You can enable or disable these interactors by using the 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.

CanvasInteractors (last edited 2009-09-20 23:47:41 by localhost)