[OpenLayers-Users] Re: Limit features returned by hover event on Vector Layer?

Planet)x andrew.stewart at reddeer.ca
Thu Mar 3 13:04:37 EST 2011


 So I got this to work by using a selectfeature control, the response is now
returning only the selectfeature when I move the mouse over that feature.
Now I need to seperate events for both a mouseover and a click event, except
I see that they are both related to the featureselected event. Can I
distinguish between a click/hover as I need to do display different things
if the feature is clicked or hovered. Appreciate any help!

var selectControl = new OpenLayers.Control.SelectFeature(
                [test_hydrants],
                {
                    clickout: false, toggle: false,
                    multiple: false, hover: true
                }
            );


        map.addControl(selectControl);
            selectControl.activate();
            
            test_hydrants.events.on({
                "featureselected": function(e) {
                tooltip.destroy();
	                tooltip = new Ext.ToolTip({
                    html: 'Hydrant' + '
' +  'wt' + e.feature.attributes.ATS_Desc + '-' +
e.feature.attributes.trig_Label_INF_Hydrant + '
' + '(' + e.feature.attributes.Year_Install + ')',
                    dismissDelay: 3000
                    });
                    tooltip.targetXY = [(x_pos + -50),(y_pos - 70)];
                    tooltip.show();
                }
            });

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Limit-features-returned-by-hover-event-on-Vector-Layer-tp6085625p6085786.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list