Protect the trigger action of pan control by checking whether

we were added to a map prior to calling this.map.pan().
This commit is contained in:
Marc Jansen
2012-04-17 21:25:56 +02:00
parent 53ed973eec
commit 56d7cee8cf
+2 -1
View File
@@ -70,7 +70,7 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
* Method: trigger * Method: trigger
*/ */
trigger: function(){ trigger: function(){
if (this.map) {
var getSlideFactor = OpenLayers.Function.bind(function (dim) { var getSlideFactor = OpenLayers.Function.bind(function (dim) {
return this.slideRatio ? return this.slideRatio ?
this.map.getSize()[dim] * this.slideRatio : this.map.getSize()[dim] * this.slideRatio :
@@ -91,6 +91,7 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
this.map.pan(getSlideFactor("w"), 0); this.map.pan(getSlideFactor("w"), 0);
break; break;
} }
}
}, },
CLASS_NAME: "OpenLayers.Control.Pan" CLASS_NAME: "OpenLayers.Control.Pan"