Skip to content

Commit

Permalink
Adjust use of clear method on layerObj.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorix committed Aug 11, 2013
1 parent d95e3c8 commit b6c9614
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions lib/FeaturePopups.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ OpenLayers.Control.FeaturePopups = OpenLayers.Class(OpenLayers.Control, {
var layerObj = this.getLayerObj(layer);
if (layerObj) {
if (this.active) {
this.active && layerObj.clear();
layerObj.clear();
this.controls.hover && this.controls.hover.setLayer(
this.layers.slice());
this.controls.select && this.controls.select.setLayer(
Expand Down Expand Up @@ -2022,6 +2022,7 @@ OpenLayers.Control.FeaturePopups.Layer = OpenLayers.Class({
*/
destroy: function() {
this.deactivate();
this.clear();
this.popupObj && this.popupObj.destroy();
this.eventListeners && this.events.un(this.eventListeners);
this.events.destroy();
Expand Down Expand Up @@ -2055,7 +2056,7 @@ OpenLayers.Control.FeaturePopups.Layer = OpenLayers.Class({
},

/**
* APIMethod: clear
* Method: clear
* Clear selection stored if <safeSelection> is true.
*/
clear: function() {
Expand All @@ -2064,22 +2065,6 @@ OpenLayers.Control.FeaturePopups.Layer = OpenLayers.Class({
this.selectionHash = '';
this.staticSelectionHash = '';
this.featuresHash = '';
if (this.active) {
if (this.selectionHash !== '') {
this.events.triggerEvent('selectionchanged', {
layer: this.layer,
control: this.control,
selection: []
});
}
if (this.featuresHash !== '') {
this.events.triggerEvent('featureschanged', {
layer: this.layer,
control: this.control,
features: []
});
}
}
},

/**
Expand Down

0 comments on commit b6c9614

Please sign in to comment.