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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to