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,26 +70,27 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
|
||||
* Method: trigger
|
||||
*/
|
||||
trigger: function(){
|
||||
if (this.map) {
|
||||
var getSlideFactor = OpenLayers.Function.bind(function (dim) {
|
||||
return this.slideRatio ?
|
||||
this.map.getSize()[dim] * this.slideRatio :
|
||||
this.slideFactor;
|
||||
}, this);
|
||||
|
||||
var getSlideFactor = OpenLayers.Function.bind(function (dim) {
|
||||
return this.slideRatio ?
|
||||
this.map.getSize()[dim] * this.slideRatio :
|
||||
this.slideFactor;
|
||||
}, this);
|
||||
|
||||
switch (this.direction) {
|
||||
case OpenLayers.Control.Pan.NORTH:
|
||||
this.map.pan(0, -getSlideFactor("h"));
|
||||
break;
|
||||
case OpenLayers.Control.Pan.SOUTH:
|
||||
this.map.pan(0, getSlideFactor("h"));
|
||||
break;
|
||||
case OpenLayers.Control.Pan.WEST:
|
||||
this.map.pan(-getSlideFactor("w"), 0);
|
||||
break;
|
||||
case OpenLayers.Control.Pan.EAST:
|
||||
this.map.pan(getSlideFactor("w"), 0);
|
||||
break;
|
||||
switch (this.direction) {
|
||||
case OpenLayers.Control.Pan.NORTH:
|
||||
this.map.pan(0, -getSlideFactor("h"));
|
||||
break;
|
||||
case OpenLayers.Control.Pan.SOUTH:
|
||||
this.map.pan(0, getSlideFactor("h"));
|
||||
break;
|
||||
case OpenLayers.Control.Pan.WEST:
|
||||
this.map.pan(-getSlideFactor("w"), 0);
|
||||
break;
|
||||
case OpenLayers.Control.Pan.EAST:
|
||||
this.map.pan(getSlideFactor("w"), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user