Skip to content
Browse files

Merge pull request #657 from ericmmartinez/master

Patch for L.Control#setPosition
  • Loading branch information...
2 parents dfb04aa + cfbf317 commit 0bd0c1a95aa9203c47ccbf1a5e5870bf3cc16633 @mourner mourner committed May 3, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/control/Control.js
View
11 src/control/Control.js
@@ -13,11 +13,16 @@ L.Control = L.Class.extend({
},
setPosition: function (position) {
+ var map = this._map;
+
+ if (map) {
+ map.removeControl(this);
+ }
+
this.options.position = position;
- if (this._map) {
- this._map.removeControl(this);
- this._map.addControl(this);
+ if (map) {
+ map.addControl(this);
}
},

0 comments on commit 0bd0c1a

Please sign in to comment.
Something went wrong with that request. Please try again.