Re: [OpenMap Users] Turn mouse MouseWheel Zoom OFF

From: Sean Kaner <smkaner_at_gmail.com>
Date: Thu, 16 Apr 2009 09:20:44 -0400

I have tried both suggestions and removing the mouseWheelListeners
from the mapBean
as Derek suggest does work and satisfies my immediate needs.

I would like to be able to make it work with the mouse modes if
possible and to understand how an extended mouse mode works.

I added the extended mouse mode via the mapHandler, the
MouseDelegator and MapBean are already added to the mapHandler. The
mouseMoved function still doesn't get hit. I looked into using the
setMouseModeIDsForEvents(mouseModes) instead of overriding
getMouseModeServiceList, but I only see that function available in
the Class OMGraphicHandlerLayer, I'm only using the class Layer so I'm
not able to use that.
The reason I have the getMouseModeServiceList function at all, is
because the layer
implements MapMouseListener this is used so panning can be enabled and disabled.

I also tried to set the active mode after adding to the mapHandler
using mouseDelegator,
I don't know if this is necessary or not.

setActiveMouseModeWithID(MyNavMouseMode.modeID)

But that seemed to make things worse, I lost my right clicks.

When I print out what kind of mouseWheelListener gets removed it says
it's a SelectMouseMode, so I tried subclassing that instead of
NavMouseMode,
but that didn't work either.

I was able to get the mouseWheelMoved function called if I make this call

mapBean.addMouseWheelListener(new MySelectMouseMode())

But it doesn't replace the selectMouseMode already there, so the map
still zooms.

Thanks for your suggestions,

Sean

On 4/15/09, Don Dietrick <dietrick_at_bbn.com> wrote:
> Hi Sean,
>
> Hi Sean,
>
> I'd add your mouse mode to the MapHandler instead of the
> MouseDelegator, and add the MouseDelegator and MapBean to it as well.
> You don't have to hook things up programmatically, use the MapHander
> and add everything to it to let that mechanism make the connections.
>
> I have the feeling your mouse mode isn't being added as a listener to
> the MapBean.
>
> Also, in your layer, I wouldn't override the getMouseModeServiceList
> method. Call setMouseModeIDsForEvents(mouseModes) instead.
>
> - Don
>
> On Apr 15, 2009, at 10:38 AM, Sean Kaner wrote:
>
>> 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 Thu Apr 16 2009 - 09:21:43 EDT

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