Merge pull request #805 from mosesonline/unselectAllFix
unselectAll on removing layer fix
This commit is contained in:
@@ -305,12 +305,17 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
for(l=0; l<layers.length; ++l) {
|
||||
layer = layers[l];
|
||||
numExcept = 0;
|
||||
while(layer.selectedFeatures.length > numExcept) {
|
||||
feature = layer.selectedFeatures[numExcept];
|
||||
if(!options || options.except != feature) {
|
||||
this.unselect(feature);
|
||||
} else {
|
||||
++numExcept;
|
||||
//layer.selectedFeatures is null when layer is destroyed and
|
||||
//one of it's preremovelayer listener calls setLayer
|
||||
//with another layer on this control
|
||||
if(layer.selectedFeatures != null) {
|
||||
while(layer.selectedFeatures.length > numExcept) {
|
||||
feature = layer.selectedFeatures[numExcept];
|
||||
if(!options || options.except != feature) {
|
||||
this.unselect(feature);
|
||||
} else {
|
||||
++numExcept;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,10 +325,8 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
|
||||
// we enter handle. Yes, a bit hackish...
|
||||
this.feature = null;
|
||||
}
|
||||
} else {
|
||||
if(this.lastFeature && (previouslyIn || click)) {
|
||||
this.triggerCallback(type, 'out', [this.lastFeature]);
|
||||
}
|
||||
} else if(this.lastFeature && (previouslyIn || click)) {
|
||||
this.triggerCallback(type, 'out', [this.lastFeature]);
|
||||
}
|
||||
return handled;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user