[OpenLayers-Users] OpenLayers.Feature.Vector hover + click event
_greg_
gstopar at gmail.com
Thu Dec 10 07:30:49 EST 2009
Hi,
Thanks for your answer.
Yes. I've tried this and here is what happens:
1. I click first on draggable feature => click event occurs => cool
2. Click on second not draggable feature => click event occurs => cool
3. Click again on first feature => click event is not dispatched.
Any ideas ?
Ivan Grcic-2 wrote:
>
> Hi,
> selectFeature doesnt have click event:
> http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Control/SelectFeature-js.html#OpenLayers.Control.SelectFeature.EVENT_TYPES
>
> Defining callback for click should work though
>
>
> OpenLayers.Control.SelectFeature([vector1,vector2],{
> hover : true,
> highlightOnly : false,
> callbacks: {
> click : function (feat){
> // do what you want here
> }
> }
> });
> );
>
> Cheers
>
> On Thu, Dec 10, 2009 at 12:34 PM, _greg_ <gstopar at gmail.com> wrote:
>>
>> Hi all
>>
>> Is possible to recive click events and have hover turned on with
>> OpenLayers.Control.SelectFeature ?
>> I have two vector layers. One for draggable features and another for not
>> draggable.
>> I want to be able to select features from both layers (I'm using OL-2.8).
>> Feature hover works fine and also featureselected events are ok. But I
>> do
>> not get click events.
>>
>> My code is :
>> ...
>> var vector1 = new OpenLayers.Layer.Vector("NotDraggableMarkers",{
>> isBaseLayer : false,
>> rendererOptions : {
>> yOrdering : true
>> },
>> styleMap : this.getMarkerStyleMap()
>>
>>
>> });
>> var vector2 = new OpenLayers.Layer.Vector("DraggableMarkers",{
>> isBaseLayer : false,
>> rendererOptions : {
>> yOrdering : true
>> },
>> styleMap : this.getMarkerStyleMap()
>>
>> });
>>
>> this.map.addLayers([vector1,vector2]);
>>
>>
>> var dragFeature = new OpenLayers.Control.DragFeature(vector2);
>> this.map.addControl(dragFeature);
>> dragFeature.activate();
>>
>>
>> var select = new
>> OpenLayers.Control.SelectFeature([vector1,vector2],{
>> hover : true,
>> highlightOnly : false
>>
>> });
>>
>> this.map.addControl(select);
>> select.events.on({
>> "featurehighlighted" : this.high,
>> "click" : this.click
>> });
>> ...
>>
>> Is there any way to do this ? Any ideas ?
>> Thanks.
>> --
>> View this message in context:
>> http://n2.nabble.com/OpenLayers-Feature-Vector-hover-click-event-tp4144872p4144872.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
>
> --
> Ivan Grcic
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://n2.nabble.com/OpenLayers-Feature-Vector-hover-click-event-tp4144872p4145073.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list