Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

leaflet-side-by-side.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. (function (global){
  3. var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null)
  4. require('./layout.css')
  5. require('./range.css')
  6. var mapWasDragEnabled
  7. var mapWasTapEnabled
  8. // Leaflet v0.7 backwards compatibility
  9. function on (el, types, fn, context) {
  10. types.split(' ').forEach(function (type) {
  11. L.DomEvent.on(el, type, fn, context)
  12. })
  13. }
  14. // Leaflet v0.7 backwards compatibility
  15. function off (el, types, fn, context) {
  16. types.split(' ').forEach(function (type) {
  17. L.DomEvent.off(el, type, fn, context)
  18. })
  19. }
  20. function getRangeEvent (rangeInput) {
  21. return 'oninput' in rangeInput ? 'input' : 'change'
  22. }
  23. function cancelMapDrag () {
  24. mapWasDragEnabled = this._map.dragging.enabled()
  25. mapWasTapEnabled = this._map.tap && this._map.tap.enabled()
  26. this._map.dragging.disable()
  27. this._map.tap && this._map.tap.disable()
  28. }
  29. function uncancelMapDrag (e) {
  30. this._refocusOnMap(e)
  31. if (mapWasDragEnabled) {
  32. this._map.dragging.enable()
  33. }
  34. if (mapWasTapEnabled) {
  35. this._map.tap.enable()
  36. }
  37. }
  38. // convert arg to an array - returns empty array if arg is undefined
  39. function asArray (arg) {
  40. return (arg === 'undefined') ? [] : Array.isArray(arg) ? arg : [arg]
  41. }
  42. function noop () {}
  43. L.Control.SideBySide = L.Control.extend({
  44. options: {
  45. thumbSize: 42,
  46. padding: 0
  47. },
  48. initialize: function (leftLayers, rightLayers, options) {
  49. this.setLeftLayers(leftLayers)
  50. this.setRightLayers(rightLayers)
  51. L.setOptions(this, options)
  52. },
  53. getPosition: function () {
  54. var rangeValue = this._range.value
  55. var offset = (0.5 - rangeValue) * (2 * this.options.padding + this.options.thumbSize)
  56. return this._map.getSize().x * rangeValue + offset
  57. },
  58. setPosition: noop,
  59. includes: L.Evented.prototype || L.Mixin.Events,
  60. addTo: function (map) {
  61. this.remove()
  62. this._map = map
  63. var container = this._container = L.DomUtil.create('div', 'leaflet-sbs', map._controlContainer)
  64. this._divider = L.DomUtil.create('div', 'leaflet-sbs-divider', container)
  65. var range = this._range = L.DomUtil.create('input', 'leaflet-sbs-range', container)
  66. range.type = 'range'
  67. range.min = 0
  68. range.max = 1
  69. range.step = 'any'
  70. range.value = 0.5
  71. range.style.paddingLeft = range.style.paddingRight = this.options.padding + 'px'
  72. this._addEvents()
  73. this._updateLayers()
  74. return this
  75. },
  76. remove: function () {
  77. if (!this._map) {
  78. return this
  79. }
  80. if (this._leftLayer) {
  81. this._leftLayer.getContainer().style.clip = ''
  82. }
  83. if (this._rightLayer) {
  84. this._rightLayer.getContainer().style.clip = ''
  85. }
  86. this._removeEvents()
  87. L.DomUtil.remove(this._container)
  88. this._map = null
  89. return this
  90. },
  91. setLeftLayers: function (leftLayers) {
  92. this._leftLayers = asArray(leftLayers)
  93. this._updateLayers()
  94. return this
  95. },
  96. setRightLayers: function (rightLayers) {
  97. this._rightLayers = asArray(rightLayers)
  98. this._updateLayers()
  99. return this
  100. },
  101. _updateClip: function () {
  102. var map = this._map
  103. var nw = map.containerPointToLayerPoint([0, 0])
  104. var se = map.containerPointToLayerPoint(map.getSize())
  105. var clipX = nw.x + this.getPosition()
  106. var dividerX = this.getPosition()
  107. this._divider.style.left = dividerX + 'px'
  108. this.fire('dividermove', {x: dividerX})
  109. var clipLeft = 'rect(' + [nw.y, clipX, se.y, nw.x].join('px,') + 'px)'
  110. var clipRight = 'rect(' + [nw.y, se.x, se.y, clipX].join('px,') + 'px)'
  111. if (this._leftLayer) {
  112. this._leftLayer.getContainer().style.clip = clipLeft
  113. }
  114. if (this._rightLayer) {
  115. this._rightLayer.getContainer().style.clip = clipRight
  116. }
  117. },
  118. _updateLayers: function () {
  119. if (!this._map) {
  120. return this
  121. }
  122. var prevLeft = this._leftLayer
  123. var prevRight = this._rightLayer
  124. this._leftLayer = this._rightLayer = null
  125. this._leftLayers.forEach(function (layer) {
  126. if (this._map.hasLayer(layer)) {
  127. this._leftLayer = layer
  128. }
  129. }, this)
  130. this._rightLayers.forEach(function (layer) {
  131. if (this._map.hasLayer(layer)) {
  132. this._rightLayer = layer
  133. }
  134. }, this)
  135. if (prevLeft !== this._leftLayer) {
  136. prevLeft && this.fire('leftlayerremove', {layer: prevLeft})
  137. this._leftLayer && this.fire('leftlayeradd', {layer: this._leftLayer})
  138. }
  139. if (prevRight !== this._rightLayer) {
  140. prevRight && this.fire('rightlayerremove', {layer: prevRight})
  141. this._rightLayer && this.fire('rightlayeradd', {layer: this._rightLayer})
  142. }
  143. this._updateClip()
  144. },
  145. _addEvents: function () {
  146. var range = this._range
  147. var map = this._map
  148. if (!map || !range) return
  149. map.on('move', this._updateClip, this)
  150. map.on('layeradd layerremove', this._updateLayers, this)
  151. on(range, getRangeEvent(range), this._updateClip, this)
  152. on(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
  153. on(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
  154. },
  155. _removeEvents: function () {
  156. var range = this._range
  157. var map = this._map
  158. if (range) {
  159. off(range, getRangeEvent(range), this._updateClip, this)
  160. off(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
  161. off(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
  162. }
  163. if (map) {
  164. map.off('layeradd layerremove', this._updateLayers, this)
  165. map.off('move', this._updateClip, this)
  166. }
  167. }
  168. })
  169. L.control.sideBySide = function (leftLayers, rightLayers, options) {
  170. return new L.Control.SideBySide(leftLayers, rightLayers, options)
  171. }
  172. module.exports = L.Control.SideBySide
  173. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  174. },{"./layout.css":2,"./range.css":4}],2:[function(require,module,exports){
  175. var inject = require('./node_modules/cssify');
  176. var css = ".leaflet-sbs-range {\r\n position: absolute;\r\n top: 50%;\r\n width: 100%;\r\n z-index: 999;\r\n}\r\n.leaflet-sbs-divider {\r\n position: absolute;\r\n top: 0;\r\n bottom: 0;\r\n left: 50%;\r\n margin-left: -2px;\r\n width: 4px;\r\n background-color: #fff;\r\n pointer-events: none;\r\n z-index: 999;\r\n}\r\n";
  177. inject(css, undefined, '_i6aomd');
  178. module.exports = css;
  179. },{"./node_modules/cssify":3}],3:[function(require,module,exports){
  180. 'use strict'
  181. function injectStyleTag (document, fileName, cb) {
  182. var style = document.getElementById(fileName)
  183. if (style) {
  184. cb(style)
  185. } else {
  186. var head = document.getElementsByTagName('head')[0]
  187. style = document.createElement('style')
  188. if (fileName != null) style.id = fileName
  189. cb(style)
  190. head.appendChild(style)
  191. }
  192. return style
  193. }
  194. module.exports = function (css, customDocument, fileName) {
  195. var doc = customDocument || document
  196. /* istanbul ignore if: not supported by Electron */
  197. if (doc.createStyleSheet) {
  198. var sheet = doc.createStyleSheet()
  199. sheet.cssText = css
  200. return sheet.ownerNode
  201. } else {
  202. return injectStyleTag(doc, fileName, function (style) {
  203. /* istanbul ignore if: not supported by Electron */
  204. if (style.styleSheet) {
  205. style.styleSheet.cssText = css
  206. } else {
  207. style.innerHTML = css
  208. }
  209. })
  210. }
  211. }
  212. module.exports.byUrl = function (url) {
  213. /* istanbul ignore if: not supported by Electron */
  214. if (document.createStyleSheet) {
  215. return document.createStyleSheet(url).ownerNode
  216. } else {
  217. var head = document.getElementsByTagName('head')[0]
  218. var link = document.createElement('link')
  219. link.rel = 'stylesheet'
  220. link.href = url
  221. head.appendChild(link)
  222. return link
  223. }
  224. }
  225. },{}],4:[function(require,module,exports){
  226. var inject = require('./node_modules/cssify');
  227. var css = ".leaflet-sbs-range {\r\n -webkit-appearance: none;\r\n display: inline-block!important;\r\n vertical-align: middle;\r\n height: 0;\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n background: rgba(0, 0, 0, 0.25);\r\n min-width: 100px;\r\n cursor: pointer;\r\n pointer-events: none;\r\n z-index: 999;\r\n}\r\n.leaflet-sbs-range::-ms-fill-upper {\r\n background: transparent;\r\n}\r\n.leaflet-sbs-range::-ms-fill-lower {\r\n background: rgba(255, 255, 255, 0.25);\r\n}\r\n/* Browser thingies */\r\n\r\n.leaflet-sbs-range::-moz-range-track {\r\n opacity: 0;\r\n}\r\n.leaflet-sbs-range::-ms-track {\r\n opacity: 0;\r\n}\r\n.leaflet-sbs-range::-ms-tooltip {\r\n display: none;\r\n}\r\n/* For whatever reason, these need to be defined\r\n * on their own so dont group them */\r\n\r\n.leaflet-sbs-range::-webkit-slider-thumb {\r\n -webkit-appearance: none;\r\n margin: 0;\r\n padding: 0;\r\n background: #fff;\r\n height: 40px;\r\n width: 40px;\r\n border-radius: 20px;\r\n cursor: ew-resize;\r\n pointer-events: auto;\r\n border: 1px solid #ddd;\r\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\r\n background-position: 50% 50%;\r\n background-repeat: no-repeat;\r\n background-size: 40px 40px;\r\n}\r\n.leaflet-sbs-range::-ms-thumb {\r\n margin: 0;\r\n padding: 0;\r\n background: #fff;\r\n height: 40px;\r\n width: 40px;\r\n border-radius: 20px;\r\n cursor: ew-resize;\r\n pointer-events: auto;\r\n border: 1px solid #ddd;\r\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\r\n background-position: 50% 50%;\r\n background-repeat: no-repeat;\r\n background-size: 40px 40px;\r\n}\r\n.leaflet-sbs-range::-moz-range-thumb {\r\n padding: 0;\r\n right: 0 ;\r\n background: #fff;\r\n height: 40px;\r\n width: 40px;\r\n border-radius: 20px;\r\n cursor: ew-resize;\r\n pointer-events: auto;\r\n border: 1px solid #ddd;\r\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\r\n background-position: 50% 50%;\r\n background-repeat: no-repeat;\r\n background-size: 40px 40px;\r\n}\r\n.leaflet-sbs-range:disabled::-moz-range-thumb {\r\n cursor: default;\r\n}\r\n.leaflet-sbs-range:disabled::-ms-thumb {\r\n cursor: default;\r\n}\r\n.leaflet-sbs-range:disabled::-webkit-slider-thumb {\r\n cursor: default;\r\n}\r\n.leaflet-sbs-range:disabled {\r\n cursor: default;\r\n}\r\n.leaflet-sbs-range:focus {\r\n outline: none!important;\r\n}\r\n.leaflet-sbs-range::-moz-focus-outer {\r\n border: 0;\r\n}\r\n\r\n";
  228. inject(css, undefined, '_1tlt668');
  229. module.exports = css;
  230. },{"./node_modules/cssify":3}]},{},[1]);