xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Archie Cobbs <arc...@dellroad.org>
Subject Re: mouse actions in JSVGCanvas changeable or deactivate ?
Date Wed, 01 Dec 2004 14:52:33 GMT
Maik Schürer wrote:
> 1) ist it possible to change e.g. the grop/zoom mouse action in JSVGCanvas
> from "Ctrl+left" mouse to "left mouse" ?
> 2) ist it possible to deactivate e.g. the rotate mouse action in JSVGCanvas
> ("Ctrl+right" mouse)

Here's what we do (abridged for clarity :-). We just want pan and zoom,
using button1 and shift-button1, respectively...

         // Disable default interactors
         svgCanvas.setEnableImageZoomInteractor(false);
         svgCanvas.setEnablePanInteractor(false);
         svgCanvas.setEnableResetTransformInteractor(false);
         svgCanvas.setEnableRotateInteractor(false);
         svgCanvas.setEnableZoomInteractor(false);

         // Add my pan and zoom interactors
         svgCanvas.getInteractors().add(new PanInteractor());
         svgCanvas.getInteractors().add(new ZoomInteractor());

...

     class PanInteractor extends AbstractPanInteractor {
         public boolean startInteraction(InputEvent ie) {
             if (!(ie instanceof MouseEvent))
                 return false;
             MouseEvent me = (MouseEvent)ie;
             return me.getID() == MouseEvent.MOUSE_PRESSED
               && (me.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) == 0
               && me.getButton() == MouseEvent.BUTTON1;
         }
     }

Our custom ZoomInteractor is similar.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message