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

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)