[OpenLayers-Dev] Hover over point - Display name
Alexandre Dube
adube at mapgears.com
Tue Apr 13 14:26:06 EDT 2010
Hi,
I'm not sure what's wrong with what you're doing, but maybe a quick look
at this example [1] might help. I would use 'highlightOnly': true only
and register events instead of overwriting the native callback methods
used when hovering.
Hope this helps,
Alexandre
http://www.openlayers.org/dev/examples/highlight-feature.html
geojoe wrote:
> I would like to hover over one of my layers and display the feature site_name
> next to the feature like a label. I would also like to have this control
> active all of the time - while pan, identify, zoomIn, ... are active.
>
>
> Using the control below the "overFeature" code is never reached.
>
>
> Help,
> Joe
>
> userHoverControl = new OpenLayers.Control.SelectFeature(
> userLayer,
> {
> hover: true,
> highlightOnly: false,
> clickout: false,
> toggle: false,
> multiple: false,
> overFeature: function(feature) {
> alert(feature.attributes.site_name);
> },
> outFeature: function(feature) {
> console.log('hover out: ' + feature.attributes.site_name);
> },
> }
> );
> map.addControl(userHoverControl);
> userHoverControl.activate();
>
>
>
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Dev
mailing list