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.