[OpenLayers-Trac] [OpenLayers] #2926: Select control do not unselect last feature if is in the first layer

OpenLayers trac-20090302 at openlayers.org
Thu Nov 11 11:40:59 EST 2010


#2926: Select control do not unselect last feature if is in the first layer
-----------------------------------+----------------------------------------
 Reporter:  PadovaBoy              |       Owner:  tschaub     
     Type:  bug                    |      Status:  new         
 Priority:  major                  |   Milestone:  2.11 Release
Component:  Control.SelectFeature  |     Version:  2.10        
 Keywords:                         |       State:              
-----------------------------------+----------------------------------------
 Windows 7, windows vista, firefox, IE8.
 In a map with many vector layers with many features the 'selectControl'
 don't unselect the previously feature correctly.
 I suppouse that the problem reside in the unselectAll.
 This is my version that resolve the problem:

 OpenLayers.Control.SelectFeature.prototype.unselectAll = function
 (options) {
                         // we'll want an option to supress notification
 here
                         var layers = this.layers || [this.layer];
                         var layer, feature;
                         for (var l = 0; l < layers.length; ++l) {
                                 layer = layers[l];
                                 //G.B.!: in original version this line
 call 'return'..
                                 if (layer.selectedFeatures.length === 0) {
 continue; }
                                 for (var i = layer.selectedFeatures.length
 - 1; i >= 0; --i) {
                                         feature =
 layer.selectedFeatures[i];
                                         if (!options || options.except !==
 feature) {
                                                 //G.B.!: add check to
 undefined
                                                 if (feature !== undefined)
 {
 this.unselect(feature);
                                                 }
                                         }
                                 }
                         }
                 }

-- 
Ticket URL: <http://trac.openlayers.org/ticket/2926>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list