I have a navigation toolbar with some common OL controls such as Navigation and ZoomBox on it.

I also have a SelectFeature control that isn't part of the navigation toolbar b/c it should be active all the time for vector features. Each layer that is added to the SelectFeature control using setLayers() has a handler registered to the 'featureselected' event.

However, in cases where I choose the ZoomBox control my ability to select vector features disappears. I have to refresh the layer to get it back. I can work with the Navigation control (in fact many other controls too) and still have my vectors responding to the select event.

Has anyone else experienced this or know a work around? Even if you have a cool Firebug way to troubleshoot this issue I'd like to hear about it.

thx mazery


You could add button for SelectFeature control into panel and deactivate ZoomBox control when SelectFeature control is active. Here is my little example.

  • 1
    I agree. You're either selecting, panning, or zoomboxing but you cannot have them all active at once. I'm sure that's why OpenLayers deactivates the selectControl when you're panning. – CaptDragon Jan 20 '12 at 14:03
  • thanks for the response guys. this was the main reason then that I wanted to create separate onclick handlers for each svg vector feature even if it's expensive. thx for the help – maztaz Jan 20 '12 at 17:15
  • @maztaz i found a solution to that gis.stackexchange.com/questions/18984/… – CaptDragon Jan 20 '12 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.