[OpenLayers-Users] ZoomBox event

Alexandre Dube adube at mapgears.com
Wed Jun 2 08:13:07 EDT 2010


Mark,

How about registering an "activate" event on your ZoomBox control to 
register a map "zoomend" event in order to toggle your active control ? 
Something like that (untested) :

YourZoomBoxCtrl.events.on({"activate": onZoomBoxActivate, "scope": 
YourZoomBoxCtrl });
function onZoomBoxActivate(){
yourMap.events.on({"zoomend": onMapZoomEnd, "scope": yourMap});
}
function onMapZoomEnd(){
YourZoomBoxCtrl.deactivate();
YourPanCtrl.activate();
yourMap.events.un({"zoomend": onMapZoomEnd, "scope": yourMap});
}

Regards,

Alexandre


Mark Small wrote:
> Hi,
>
> I have a toolbar with a ZoomBox control, everything works as expected.
>
> I now want to change this so that I can click on the toolbar button for the
> zoom box, drag on the map to zoom, once the event has completed, switch off
> the toolbar button (lose focus, or whatever happens), and return to the
> default pan functionality.
>
> Any ideas??
>
>
> Thanks for any assistance.
>
> MARK
>
> CIAO
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list