Cool - thanks Jody.

Yep, a mouse wheel tool sounds like a good idea...

Since posting that I also thought I'd hack my local JMapPane to get
the same behaviour with up and down arrow key strokes... actually '+'
and '-' would probably be better.  Also the class is crying out for a
method to set the zoom factor.

I suspect there are a few people who, like me, have a locally modified
version of JMapPane.  The class still seems to be used a lot judging
by messages here, while there are very few mentions of Johann's
'pending' classes.  I know at some stage there is meant to be a
beautiful new rendering system but in the meantime perhaps it would be
useful to do some housekeeping and tweaks of the JMapPane code.  Ian's
last commit was mid-2007.

Michael

2009/2/16 Jody Garnett <jody.garn...@gmail.com>:
> Thanks; once again added to the user guide:
> - http://docs.codehaus.org/display/GEOTDOC/MapPane
> I actually think we could set up a tool to respect mousewheel events; but
> have not looked at it.
>
> On Thu, Feb 5, 2009 at 10:48 AM, Michael Bedward <michael.bedw...@gmail.com>
> wrote:
>>
>> Perhaps the easiest way of doing it, without sub-classing JMapPane, is
>> something like this...
>>
>>    // somewhere in your code...
>>    double clickToZoom = 0.1;  // 1 wheel click is 10% zoom
>>
>>    // wheel event handler
>>    public void handleMouseWheelEvent(MouseWheelEvent ev) {
>>        int clicks = ev.getWheelRotation();
>>        // -ve means wheel moved up, +ve means down
>>        int sign = (clicks < 0 ? -1 : 1);
>>
>>        Envelope env = mapPane.getMapArea();
>>        double width = env.getWidth();
>>        double delta = width * clickToZoom * sign;
>>
>>        env.expandBy(delta);
>>        mapPane.setMapArea(env);
>>        mapPane.repaint();
>>    }
>>
>>
>> Warning: I can't test this because I don't have a mouse wheel :-)
>>
>> Michael
>>
>>
>> ------------------------------------------------------------------------------
>> Create and Deploy Rich Internet Apps outside the browser with
>> Adobe(R)AIR(TM)
>> software. With Adobe AIR, Ajax developers can use existing skills and code
>> to
>> build responsive, highly engaging applications that combine the power of
>> local
>> resources and data with the reach of the web. Download the Adobe AIR SDK
>> and
>> Ajax docs to start building applications
>> today-http://p.sf.net/sfu/adobe-com
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> Geotools-gt2-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to