RE: [OpenMap Users] Turn mouse MouseWheel Zoom OFF

From: Melvin, Derek R <derek.r.melvin_at_lmco.com>
Date: Wed, 15 Apr 2009 12:06:24 -0600

Hello Sean,

 

Try removing all the MouseWheelListener's from the MapBean. If you still
care about receiving wheel event notifications from the MapBean just add
your own MouseWheelListener.

 

e.g.

 

Java 1.5 & >

 

for(final MouseWheelListener listener:
mapBean.getMouseWheelListeners()){

                mapBean.removeMouseWheelListener(listener);

}

 

Or

 

MouseWheelListener[] wheelListeners = mapBean.getMouseWheelListeners();

for(int i = 0; i < wheelListeners; i++){

                mapBean.removeMouseWheelListener(wheelListeners[i]);

}

 

Hope this helps.

 

Derek Melvin

 

From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
On Behalf Of Sean Kaner
Sent: Wednesday, April 15, 2009 8:39 AM
To: Don Dietrick
Cc: openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] Turn mouse MouseWheel Zoom OFF

 

Hi Don,

I have tried to extend the NavMouseMode,

public class MyNavMouseMode extends NavMouseMode{
     public void mouseWheelMoved(

      MouseWheelEvent e) {

            System.out.println("Do Nothing");

              }


}

but I seem to be missing how to make it active.
I've seen some mention of doing this via the properties file, but my
application doesn't use
a properties file. So instead I've tried to add it using the
mouseDelegator, but my no op function
never gets called even though mouseDelegator.getActiveMouseModeID() says
it's in Navigation mode

Altogether In my layer I have

mouseModes = new String[]{
  NavMouseMode.modeID
};

public String[] getMouseModeServiceList(){return mouseModes;}


mouseDelegator.add(new MyNavMouseMode());

How can I make myNavMouseMode mouseWheelMoved get called?
Is NavMouseMode the right mode to extend if I want to consume the
mouseWheelMoved events and not zoom?

Thanks,

Sean



On Tue, Apr 14, 2009 at 11:54 PM, Don Dietrick <dietrick_at_bbn.com> wrote:

Hi Sean,

There isn't a setting on the MouseModes that let you turn off the mouse
wheel responses, but you could extend the MouseModes you want and
override the method that causes the scale to change when the mouse wheel
moves:

public void mouseWheelMoved(MouseWheelEvent e) {

}

Just override the method to do a no-op, and you should get the desired
behavior. It's a good idea to add a setting to allow this behavior to
be turned off, but if you want this behavior now, this would be the way
to do it.

Hope this helps,

Don




On Apr 11, 2009, at 12:30 PM, Sean Kaner wrote:

        Is there any way to stop the map from zooming or changing the
scale as a
        result of the mouseWheel being moved.
        
        Thanks,
        
        Sean

        --
        [To unsubscribe to this list send an email to "majdart_at_bbn.com"
        with the following text in the BODY of the message "unsubscribe
openmap-users"]

 

 



--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Apr 15 2009 - 14:08:43 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT