[OpenLayers-Dev] SelectFeature outFeature method

Slawomir Messner slawomir.messner at staff.uni-marburg.de
Fri Jul 29 06:46:47 EDT 2011


Hi,
I think, this is because if the "string" is executed there is a second 
control(like maybe in your case) which has highlighted the feature 
before so it is the previous highlighter and it highlights the feature. 
It is not unhighlighted because it's highlighted by the previous 
highlighter. Because it is not highlighted the event is not triggered. I 
think this behaviour is unexpected if you see it first because you 
always get an highlighted event but in this case not the symmetric 
event. So you cannot know when your mouse is out except you change the 
SelectFeature-class. I hope it clears a little what's happening.
It think too this behaviour could be changed, because you should always 
be aware for a second select control (and listen to it if you want) if 
you want to monitor all highlighted features. In the most cases you want 
to know if a special SelectFeature unhighlighted a feature. The thing is 
that you have to check the style to know if a feature is highlighted, 
selected features are in the selectedFeatures array, highlighted 
not(like you can read it in the new documentation;)).
Regards
Slawomir

Am 29.07.2011 12:22, schrieb Denis Rykov:
> Hi!
>
> I have two SelectFeature control on my map:
>
> #1
> var sfbm = new OpenLayers.Control.SelectFeature(
>                  map_vector_layer, {hover: true,
>                                 highlightOnly: true,
>                                 geometryTypes:
> ["OpenLayers.Geometry.Polygon", "OpenLayers.Geometry.MultiPolygon"],
>                                 eventListeners: {
>                                     featurehighlighted:   showTooltip,
>                                     featureunhighlighted: hideTooltip
>                                 }
>              });
>
> #2
> var sfbm2 = new OpenLayers.Control.SelectFeature(
>                  map_vector_layer, {hover: false,
>                                 onSelect: function(f) {
>                                     updateTable();
>                                 }
>              });
>
> I've faced with following issue. If I highlight feature by first
> control and then select this feature by second control and move cursor
> out - featureunhighlighted event not fired.
> I've tryed to analyze source code and found outFeature() method of
> control which contains string "control.highlight(feature);"  I guess
> it is cause my problem. Please explain me - what is purpose of this
> instruction and how I can solve my problem. Thanks!
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>



More information about the Dev mailing list