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:
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user