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

Alexandre Dube adube at mapgears.com
Thu Mar 3 13:11:00 EST 2011


Hi,

You could use 2 SelectFeature controls, one for selection the other for 
hovering, like in this example :
http://dev.openlayers.org/releases/OpenLayers-2.10/examples/highlight-feature.html

Regards,

Alexandre


On 11-03-03 01:04 PM, Planet)x wrote:
>   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.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list