aboutsummaryrefslogtreecommitdiffstats
path: root/extlib/leaflet/src/map/ext/Map.Control.js
diff options
context:
space:
mode:
authorAditi <aditi.iitr@gmail.com>2013-06-21 23:09:22 +0530
committerAditi <aditi.iitr@gmail.com>2013-06-21 23:09:22 +0530
commit2719d546a57c2332e36cc056ac80ec5d79672c1a (patch)
tree1f62ab8f761026d4faa5442032df133fc90d47f2 /extlib/leaflet/src/map/ext/Map.Control.js
parent1a6f065419290b3f4234ce4a89bb2c46b13e8a12 (diff)
parent92b22e7deac547835f69168f97012b52e87b6de4 (diff)
downloadmediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.tar.lz
mediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.tar.xz
mediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.zip
Merge remote-tracking branch 'cweb/master'
Diffstat (limited to 'extlib/leaflet/src/map/ext/Map.Control.js')
-rw-r--r--extlib/leaflet/src/map/ext/Map.Control.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/extlib/leaflet/src/map/ext/Map.Control.js b/extlib/leaflet/src/map/ext/Map.Control.js
new file mode 100644
index 00000000..46711a82
--- /dev/null
+++ b/extlib/leaflet/src/map/ext/Map.Control.js
@@ -0,0 +1,50 @@
+L.Map.include({
+ addControl: function(control) {
+ control.onAdd(this);
+
+ var pos = control.getPosition(),
+ corner = this._controlCorners[pos],
+ container = control.getContainer();
+
+ L.DomUtil.addClass(container, 'leaflet-control');
+
+ if (pos.indexOf('bottom') != -1) {
+ corner.insertBefore(container, corner.firstChild);
+ } else {
+ corner.appendChild(container);
+ }
+ return this;
+ },
+
+ removeControl: function(control) {
+ var pos = control.getPosition(),
+ corner = this._controlCorners[pos],
+ container = control.getContainer();
+
+ corner.removeChild(container);
+
+ if (control.onRemove) {
+ control.onRemove(this);
+ }
+ return this;
+ },
+
+ _initControlPos: function() {
+ var corners = this._controlCorners = {},
+ classPart = 'leaflet-',
+ top = classPart + 'top',
+ bottom = classPart + 'bottom',
+ left = classPart + 'left',
+ right = classPart + 'right',
+ controlContainer = L.DomUtil.create('div', classPart + 'control-container', this._container);
+
+ if (L.Browser.mobileWebkit) {
+ controlContainer.className += ' ' + classPart + 'big-buttons';
+ }
+
+ corners.topLeft = L.DomUtil.create('div', top + ' ' + left, controlContainer);
+ corners.topRight = L.DomUtil.create('div', top + ' ' + right, controlContainer);
+ corners.bottomLeft = L.DomUtil.create('div', bottom + ' ' + left, controlContainer);
+ corners.bottomRight = L.DomUtil.create('div', bottom + ' ' + right, controlContainer);
+ }
+}); \ No newline at end of file