diff options
author | Joar Wandborg <git@wandborg.com> | 2012-01-28 18:47:01 +0100 |
---|---|---|
committer | Joar Wandborg <git@wandborg.com> | 2012-01-28 18:47:01 +0100 |
commit | 3d0d3bc97270095fae5f9a2508068631c46a5e61 (patch) | |
tree | 76778fcacaae35fc5662f276dab512a07bcee186 /extlib/leaflet/src/map/ext/Map.Control.js | |
parent | d7bec8577ea1b4d83df097f586324445fed1ef50 (diff) | |
parent | 9542a2ba076b7e00e79d7adb1a4e90a095427645 (diff) | |
download | mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.tar.lz mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.tar.xz mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.zip |
Merge remote-tracking branch 'joar/exif-rebase'
Diffstat (limited to 'extlib/leaflet/src/map/ext/Map.Control.js')
-rw-r--r-- | extlib/leaflet/src/map/ext/Map.Control.js | 50 |
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 |