[OpenLayers-Users] Events on text labels

bartvde at osgis.nl bartvde at osgis.nl
Fri Jul 17 07:52:04 EDT 2009


Hi Tamlyn,

please always cc the list. I am unfamiliar with the contents of this patch
(I just knew of its existance), but maybe Paul or Andreas can shine a
light on this?

Best regards,
Bart

>> you might want to check out:
>> http://trac.openlayers.org/ticket/2148
>
> That looks perfect! I've applied the patch and got the
> symbolizers-fill-stroke-graphic.html example working but I don't quite
> understand how to use the labelSelect property.
>
> This is what I've got:
>
> ...
> var textLayer = new OpenLayers.Layer.Vector('text', {
> 	styleMap: new OpenLayers.Style({
> 		label: '${label}',
> 		pointRadius: 5,
> 		labelSelect: true
> 	})
> });
> textLayer.addFeatures([
> 	new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0,51),
> {label: 'Testing'})
> ]);
> var control = new OpenLayers.Control.SelectFeature(textLayer, {
> 	onSelect: function(e){console.log(e)}
> });
> ...
>
> which renders a point with a label. Clicking on the point logs an
> event to the (Firebug) console as expected but clicking on the label
> still does nothing. I guess I've put the labelSelect option in the
> wrong place?
>
>   T.
>





More information about the Users mailing list