You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Eric Delacroix <ed...@hotmail.com> on 2003/03/01 19:17:15 UTC
Customising interactors
Hello,
I'm still trying to customize the zoom and pan functions of JSVGCanvas, by
making them working on clicking their button. So when you press a button it
enables the associated function and disables all the others. But I'd like to
make it possible to do that just by clicking the left mouse-button. So I
wrote a class that extends JSVGCanvas and tried to override the interactors
(just erasing tha part between stars)
protected Interactor zoomInteractor = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED; /*&&
(mods & ie.BUTTON1_MASK) != 0 &&
(mods & ie.CTRL_MASK) != 0;*/
}
};
but when trying to use it, I still have to push the CTRL key to have the
effect.
Is there other functions to override?
Thank you
Eric Delacroix
ULB Brussel
_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous !
http://search.fr.msn.be
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
RE: Customising interactors
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "ED" == Eric Delacroix <ed...@hotmail.com> writes:
ED> I'm still trying to customize the zoom and pan functions of
ED> JSVGCanvas, by making them working on clicking their button. So
ED> when you press a button it enables the associated function and
ED> disables all the others. But I'd like to make it possible to do
ED> that just by clicking the left mouse-button. So I wrote a class
ED> that extends JSVGCanvas and tried to override the interactors
ED> (just erasing tha part between stars)
ED> protected Interactor zoomInteractor = new AbstractZoomInteractor()
ED> { public boolean startInteraction(InputEvent ie) { int mods =
ED> ie.getModifiers(); return ie.getID() == MouseEvent.MOUSE_PRESSED;
ED> /*&& (mods & ie.BUTTON1_MASK) != 0 && (mods & ie.CTRL_MASK) !=
ED> 0;*/ } };
If you just put the above code in a subclass it would do almost
nothing. It would define a new class member zoomInterator, but you
probably wanted to replace the zoomInteractor defined by JSVGCanvas.
In general what you want to do is write your own classes that
create a new Affine Matrix to set with 'setRenderingTransform'.
Capturing the user events and the creation of the affine transform are
all done using the standard JDK mechanisms.
ED> but when trying to use it, I still have to push the CTRL key to
ED> have the effect. Is there other functions to override?
Probably because you never register your new zoom interactor.
Thank you
ED> Eric Delacroix ULB Brussel
ED> _________________________________________________________________
ED> MSN Search, le moteur de recherche qui pense comme vous !
ED> http://search.fr.msn.be
ED> ---------------------------------------------------------------------
ED> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
ED> additional commands, e-mail: batik-users-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org