xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject RE: Dragable rectangle
Date Sat, 08 Apr 2006 22:50:53 GMT
Hi Yasmin,

   You just need to create a new subclass of 
AbstractZoomInteractor.startInteraction, the one in
the Canvas has:

    protected Interactor zoomInteractor = new AbstractZoomInteractor() {
        public boolean startInteraction(InputEvent ie) {
            int mods = ie.getModifiers();
            return
                ie.getID() == MouseEvent.MOUSE_PRESSED &&
                (mods & InputEvent.BUTTON1_MASK) != 0 &&
                (mods & InputEvent.CTRL_MASK) != 0;
        }
    };

        You will want to check that it's mouse down and that the user has
clicked your button, instead of just checking if it is a button1 with ctrl 
down.

rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:

> 
> Hi Javid,
> 
> Yes, the JSVGCanvas already does what I want to do, you know when u 
wantto
> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL 
&
> MouseDown' ...well, I want to achieve the same by assigning this to a
> button, so the user can just click the button and then drag a rectangle 
to
> select the area ...so, that my UI is user friendly, assuming that the 
user
> does not know about the 'Key' shortCuts... hope that make sense :(
> 
> yasmin
> 
> 
> > Yasmin,
> > What do you mean by assign it to JButton? To me, it looks like 
whatever
> > you
> > are trying to do JSVGCanvas already does that.
> > Can you explain a bit more?
> >
> > Javid
> >
> > -----Original Message-----
> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> > Sent: Saturday, April 08, 2006 3:24 PM
> > To: batik-users@xmlgraphics.apache.org
> > Subject: Dragable rectangle
> >
> >
> > Hi there,
> >
> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
> > area that is selected within the rectangle is zoomed-in, has anyone 
got
> > any ideas how I should go about doing this ...my thoughts are that I
> > create a mouseListener, to listen for mouseDown, whilst the mouse is 
kept
> > down to drag the rectangle until the mouseRelease event and upon
> > mouseRelease the svgMap then zoomIn to the selected area... in effect 
I'm
> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and 
assign
> > it to a Jbutton.
> >
> > Pls advice :(
> >
> > Thanx
> >
> > yasmin
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> >
> >
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Mime
View raw message