[OpenLayers-Dev] SelectFeature outFeature method

Xavier Mamano (jorix) xavier.mamano at gmail.com
Tue Jul 17 16:42:04 PDT 2012


Hi scottseeker,

These details interest me much.

I understand your first line, I use a similar trick.

But I can not understand the second. And "outFeature" may occur after
"beforefeaturehighlighted" event returns false, so is not highlighted. Yet
it is also true that prevention is better, and an unnecessary
"featureunhighlighted" does not cause damage.

I want to adjust my code if necessary: In that case has identified the need
for this second line? 

Regards,

Xavier



scottseeker wrote
> 
> Since I could not find the actual solution this problem and have fixed it
> my own way I will post it incase it helps anyone else.
> 
> Version: Openlayers 2.11
> 
> In OpenLayers.Control.SelectFeature, I changed the out outFeature method
> as follows:
> 
> outFeature: function(feature) {    	
>         if(this.hover) {
>             if(this.highlightOnly) 
>             {            	
>                 // we do nothing if we're not the last highlighter of the
>                 // feature
>                 if(feature._lastHighlighter == this.id) 
>                 {                	
>                     // if another select control had highlighted the
> feature before
>                     // we did it ourself then we use that control to
> highlight the
>                     // feature as it was before we highlighted it, else we
> just
>                     // unhighlight it
>                     if(feature._prevHighlighter &&
>                        feature._prevHighlighter != this.id) 
>                     {                    	
>                         delete feature._lastHighlighter;                        
>                         var control = this.map.getControl(
>                             feature._prevHighlighter);
>                         if(control) {                        	
>                             control.highlight(feature);
>                             // THIS IS ADDED BY ME
>                            
> this.events.triggerEvent("featureunhighlighted", {feature : feature});
>                         }
>                     } else {                    	
>                         this.unhighlight(feature);
>                     }
>                 } else {
>                 	// THIS IS ELSE BLOCK AND TRIGGER CALL ADDED BY ME              	
>                 	this.events.triggerEvent("featureunhighlighted", {feature
> : feature});                	;
>                 } 
>             } else {            	
>                 this.unselect(feature);
>             }
>         }
>     },
> 

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/SelectFeature-outFeature-method-tp3890333p4988923.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.


More information about the Dev mailing list