[OpenLayers-Users] Feature hover and highlighting

Abhi abhirama.bhat at gmail.com
Fri Oct 9 08:34:53 EDT 2009


I have a vector layer defined as below:

var poiLayer = new OpenLayers.Layer.Vector("poiLayer");
map.addLayer(poiLayer);

Hover control defined as below:

var hover = new OpenLayers.Control.SelectFeature(poiLayer, {
                hover: true,
                overFeature: function(feature) {
                 var longLat = feature.wkt.match(/(\d+.\d+)/g);
                    popup = new OpenLayers.Popup("foo",
                            new OpenLayers.LonLat(longLat[0], longLat[1]),
                            new OpenLayers.Size(10, 10),
                            feature.label,
                            true);
                    feature.popup = popup;
                    map.addPopup(popup);
                    popup.updateSize();
                }
            });


When a user hovers over a feature a popup is displayed.

If I comment out the overFeature part, the feature gets highlighted on mouse
over. But, if I add the overFeature code the highlighting is lost. How do I
retain the hightlighting along with the overFeature code?

-- 
Cheers,
Abhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091009/dad7b0bc/attachment.html


More information about the Users mailing list