FeatureLayer mouseover/mouseout problem with rubber band zoom

578
2
02-27-2012 10:30 AM
LisaEidson
New Contributor III
I have a map prototype in which I've added an "invisible" feature layer on top of my map which will "appear" when a user mousesover a wilderness area and is zoomed in. This produces a nice mouseover/out effect in which the polygon in question highlights in red and the wilderness name appears in a box overlayed in the top right corner of the map. None of this will occur unless you are zoomed in to at least LOD: 5 (see info below map to know when you're at this level or greater). If you zoom in use the vertical zoom bar, things work fine; however, if you zoom in using the zoom button at the top (rubber band zoom box) the polygons will highlight, but they won't obey the mouseout. So they're being added to the map, but not removed. I think this may have something to do with the zoom button since, without the nav controls, the mouseover/mouseout feature layer functionality works flawlessly. Not sure what the problem is here. Has anybody else had trouble with the nav buttons interferring with other stuff? Any ideas on how to correct this? Thanks in advance for any assistance.

http://www.wilderness.net/maptest_featureLayer.htm
0 Kudos
2 Replies
derekswingley1
Frequent Contributor
After you zoom or pan, you need to deactivate your navToolbar:
navToolbar.deactivate();


But I don't think you actually need either of those buttons�?? both of these navigation methods are built into the API for you. To pan, tell users to click and drag (most should already know this if they've used a map on the web in the past five years). For rubber band zoom, tell the user they can hold shift + click and drag to draw a box and zoom.
0 Kudos
LisaEidson
New Contributor III
I tried deactivating/reactivating the toolbar by adding navToolbar.deactivate() and navToolbar.activate(mapType) into the showLoading and hideLoading functions which run onUpdateStart and onUpdateEnd respectively. Unfortunately this still doesn't fix the problem and causes others related to the navbar. Although I know that the user can shift/click/drag to use the rubber band zoom, this isn't intuitive for the audience that I'm designing the map for. That's why I want to keep the pan/zoom buttons. I also don't really want to disable the toolbar because this means that the user has to click on the button each time they want to use it instead of clicking, say, on the zoom button and being able to use the rubber band zoom successively. Any other way to solve the featureLayer problem or am I misunderstanding where I should be putting the deactiveate/reactivate code?
0 Kudos