Hmm, that seems a bit confusing to the user, especially if accidentally invoked. I've never been fond of interfaces that take control of my cursor, like jumping it to be over the default button. It might have a bad interaction with other modes for accessibility such as mouse keys. However if you want to try, I suppose you could use postEvent().
regards, Larry On 8/17/07, Paul Austin <[EMAIL PROTECTED]> wrote: > Hi Larry, > > What I wanted to do is move the cursor and the point to the center of > the viewport. > > Paul > > Larry Becker wrote: > > OK the code to perform the mouse wheel zoom at cursor is: > > > > public void mouseWheelMoved(MouseWheelEvent e) { > > int nclicks = e.getWheelRotation(); //negative is up/away > > try { > > double zoomFactor = (nclicks > 0) > > ? (1 / (Math.abs(nclicks)*WHEEL_ZOOM_IN_FACTOR)) : > > (Math.abs(nclicks)*WHEEL_ZOOM_IN_FACTOR); > > zoomAt(e.getPoint(), zoomFactor); //zoom to cursor > > Coordinate zoomPoint = > > getPanel().getViewport().toModelCoordinate(e.getPoint()); > > Coordinate centre = > > getPanel().getViewport().getEnvelopeInModelCoordinates().centre(); > > double xDisplacement = zoomPoint.x - centre.x; > > double yDisplacement = zoomPoint.y - centre.y; > > Envelope oldEnvelope = > > getPanel().getViewport().getEnvelopeInModelCoordinates(); > > getPanel().getViewport().zoom(new > > Envelope(oldEnvelope.getMinX() - > > xDisplacement, oldEnvelope.getMaxX() - xDisplacement, > > oldEnvelope.getMinY() - yDisplacement, > > oldEnvelope.getMaxY() - yDisplacement)); > > // zoomAt(getPanel().getViewport().toViewPoint( //zoom to center > > // getPanel().getViewport(). > > // getEnvelopeInModelCoordinates().centre()), > > zoomFactor); > > } catch (Throwable t) { > > getPanel().getContext().handleThrowable(t); > > } > > } > > > > If everyone likes this mode better (I do), I'll commit the changes to > > ZoomTool. > > > > regards, > > Larry > > > > On 8/17/07, Paul Austin <[EMAIL PROTECTED]> wrote: > > > >> Does anyone know the easiest way to move the mouse pointer to the center > >> of the map viewport. What I want to do is when you zoom using my > >> suggested center at current mouse location on Shirt + mouse wheel that > >> it moves the mouse to the center of the viewport. This way if you want > >> to zoom in several levels at the same spot your mouse is always on that > >> spot. > >> > >> Paul > >> > >> ------------------------------------------------------------------------- > >> This SF.net email is sponsored by: Splunk Inc. > >> Still grepping through log files to find problems? Stop. > >> Now Search log events and configuration files using AJAX and a browser. > >> Download your FREE copy of Splunk now >> http://get.splunk.com/ > >> _______________________________________________ > >> Jump-pilot-devel mailing list > >> Jump-pilot-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >> > >> > > > > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > -- http://amusingprogrammer.blogspot.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel