[OpenLayers-Users] NavToolBar events

Brad Spencer brad at cubewerx.com.au
Fri Jun 12 03:11:30 EDT 2009


Andreas,

A little more explanation, I use doubleclick for picking polygons
interactively and drag-mouse-shift for picking a whole bunch within a drag
area in my 'select mode'. The user can switch to viewing mode via my mode
toggle button and happily use the default alternatives. However, if they do
not consciously toggle off the select mode and hit the mouse-zoom button (of
the OpenLayers.Control.NavToolbar fame) instead, the defaults are
automatically restored and I am unable to pop my toggle button to keep in
sync with the functionality.

I will have a look at the movend/zoomend but I will not be able to pop my
button until they do some map navigation therefore the button will be
incorrectly set during that period. However, I can make sure that the button
does not pop when doing panning and zooming in select mode by setting a
status flag, so I think it work that way just fine. 

What I would really like is an event triggered when the user hits the
mouse-zoom button. Then I could pop my button immediately highlighting to
the user that they are now in viewing mode.

Thanks for the tip.

Cheers, Brad...


-----Original Message-----
From: andreas.hocevar at gmail.com [mailto:andreas.hocevar at gmail.com] On Behalf
Of Andreas Hocevar
Sent: Friday, June 12, 2009 4:13 PM
To: Brad Spencer
Cc: openlayers users
Subject: Re: [OpenLayers-Users] NavToolBar events

Hi Brad,

On Fri, Jun 12, 2009 at 4:04 AM, Brad Spencer<brad at cubewerx.com.au> wrote:
> I have a need to change states within my application  - i.e. standard
> ‘viewing mode’ with the standard navigation defaults set and then to
switch
> to a ‘select mode’ that changes these defaults for application specific
> purposes. I have this working just fine with the use of my own mode
control
> button that switches me back and forth.
>
> However, when the user hits the navToolbar to mouse-drag-zoom around the
> map, I have no way of knowing this has happened and consequently I am
unable
> to reset my mode control button. I do not want to remove the navToolbar as
> it is very useful.

Not sure if I understand your question right: you want to set the
application back to viewing mode as soon as the user messes with the
PanZoomBar (assuming this is what you mean by navToolbar)?

If so, you could just register a listener for the map's moveend event.
This will be triggered with everything that a user can do in the
PanZoomBar.

> I was wondering if there is a way to register an event on the navToolbar’s
> mouse-drag-zoom button so that I can correctly set my status button.

Or maybe you just want to set the application back to viewing mode
when the user zooms the map using the ZoomBar? In that case, you
register for the zoomend instead of the moveend event.

I hope this answer helps.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list