|
@@ -1,270 +1,270 @@
|
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
|
|
-
|
7
|
|
-var mapWasDragEnabled
|
8
|
|
-var mapWasTapEnabled
|
9
|
|
-
|
10
|
|
-// Leaflet v0.7 backwards compatibility
|
11
|
|
-function on (el, types, fn, context) {
|
12
|
|
- types.split(' ').forEach(function (type) {
|
13
|
|
- L.DomEvent.on(el, type, fn, context)
|
14
|
|
- })
|
15
|
|
-}
|
16
|
|
-
|
17
|
|
-// Leaflet v0.7 backwards compatibility
|
18
|
|
-function off (el, types, fn, context) {
|
19
|
|
- types.split(' ').forEach(function (type) {
|
20
|
|
- L.DomEvent.off(el, type, fn, context)
|
21
|
|
- })
|
22
|
|
-}
|
23
|
|
-
|
24
|
|
-function getRangeEvent (rangeInput) {
|
25
|
|
- return 'oninput' in rangeInput ? 'input' : 'change'
|
26
|
|
-}
|
27
|
|
-
|
28
|
|
-function cancelMapDrag () {
|
29
|
|
- mapWasDragEnabled = this._map.dragging.enabled()
|
30
|
|
- mapWasTapEnabled = this._map.tap && this._map.tap.enabled()
|
31
|
|
- this._map.dragging.disable()
|
32
|
|
- this._map.tap && this._map.tap.disable()
|
33
|
|
-}
|
34
|
|
-
|
35
|
|
-function uncancelMapDrag (e) {
|
36
|
|
- this._refocusOnMap(e)
|
37
|
|
- if (mapWasDragEnabled) {
|
38
|
|
- this._map.dragging.enable()
|
39
|
|
- }
|
40
|
|
- if (mapWasTapEnabled) {
|
41
|
|
- this._map.tap.enable()
|
42
|
|
- }
|
43
|
|
-}
|
44
|
|
-
|
45
|
|
-// convert arg to an array - returns empty array if arg is undefined
|
46
|
|
-function asArray (arg) {
|
47
|
|
- return (arg === 'undefined') ? [] : Array.isArray(arg) ? arg : [arg]
|
48
|
|
-}
|
49
|
|
-
|
50
|
|
-function noop () {}
|
51
|
|
-
|
52
|
|
-L.Control.SideBySide = L.Control.extend({
|
53
|
|
- options: {
|
54
|
|
- thumbSize: 42,
|
55
|
|
- padding: 0
|
56
|
|
- },
|
57
|
|
-
|
58
|
|
- initialize: function (leftLayers, rightLayers, options) {
|
59
|
|
- this.setLeftLayers(leftLayers)
|
60
|
|
- this.setRightLayers(rightLayers)
|
61
|
|
- L.setOptions(this, options)
|
62
|
|
- },
|
63
|
|
-
|
64
|
|
- getPosition: function () {
|
65
|
|
- var rangeValue = this._range.value
|
66
|
|
- var offset = (0.5 - rangeValue) * (2 * this.options.padding + this.options.thumbSize)
|
67
|
|
- return this._map.getSize().x * rangeValue + offset
|
68
|
|
- },
|
69
|
|
-
|
70
|
|
- setPosition: noop,
|
71
|
|
-
|
72
|
|
- includes: L.Evented.prototype || L.Mixin.Events,
|
73
|
|
-
|
74
|
|
- addTo: function (map) {
|
75
|
|
- this.remove()
|
76
|
|
- this._map = map
|
77
|
|
-
|
78
|
|
- var container = this._container = L.DomUtil.create('div', 'leaflet-sbs', map._controlContainer)
|
79
|
|
-
|
80
|
|
- this._divider = L.DomUtil.create('div', 'leaflet-sbs-divider', container)
|
81
|
|
- var range = this._range = L.DomUtil.create('input', 'leaflet-sbs-range', container)
|
82
|
|
- range.type = 'range'
|
83
|
|
- range.min = 0
|
84
|
|
- range.max = 1
|
85
|
|
- range.step = 'any'
|
86
|
|
- range.value = 0.5
|
87
|
|
- range.style.paddingLeft = range.style.paddingRight = this.options.padding + 'px'
|
88
|
|
- this._addEvents()
|
89
|
|
- this._updateLayers()
|
90
|
|
- return this
|
91
|
|
- },
|
92
|
|
-
|
93
|
|
- remove: function () {
|
94
|
|
- if (!this._map) {
|
95
|
|
- return this
|
96
|
|
- }
|
97
|
|
- if (this._leftLayer) {
|
98
|
|
- this._leftLayer.getContainer().style.clip = ''
|
99
|
|
- }
|
100
|
|
- if (this._rightLayer) {
|
101
|
|
- this._rightLayer.getContainer().style.clip = ''
|
102
|
|
- }
|
103
|
|
- this._removeEvents()
|
104
|
|
- L.DomUtil.remove(this._container)
|
105
|
|
-
|
106
|
|
- this._map = null
|
107
|
|
-
|
108
|
|
- return this
|
109
|
|
- },
|
110
|
|
-
|
111
|
|
- setLeftLayers: function (leftLayers) {
|
112
|
|
- this._leftLayers = asArray(leftLayers)
|
113
|
|
- this._updateLayers()
|
114
|
|
- return this
|
115
|
|
- },
|
116
|
|
-
|
117
|
|
- setRightLayers: function (rightLayers) {
|
118
|
|
- this._rightLayers = asArray(rightLayers)
|
119
|
|
- this._updateLayers()
|
120
|
|
- return this
|
121
|
|
- },
|
122
|
|
-
|
123
|
|
- _updateClip: function () {
|
124
|
|
- var map = this._map
|
125
|
|
- var nw = map.containerPointToLayerPoint([0, 0])
|
126
|
|
- var se = map.containerPointToLayerPoint(map.getSize())
|
127
|
|
- var clipX = nw.x + this.getPosition()
|
128
|
|
- var dividerX = this.getPosition()
|
129
|
|
-
|
130
|
|
- this._divider.style.left = dividerX + 'px'
|
131
|
|
- this.fire('dividermove', {x: dividerX})
|
132
|
|
- var clipLeft = 'rect(' + [nw.y, clipX, se.y, nw.x].join('px,') + 'px)'
|
133
|
|
- var clipRight = 'rect(' + [nw.y, se.x, se.y, clipX].join('px,') + 'px)'
|
134
|
|
- if (this._leftLayer) {
|
135
|
|
- this._leftLayer.getContainer().style.clip = clipLeft
|
136
|
|
- }
|
137
|
|
- if (this._rightLayer) {
|
138
|
|
- this._rightLayer.getContainer().style.clip = clipRight
|
139
|
|
- }
|
140
|
|
- },
|
141
|
|
-
|
142
|
|
- _updateLayers: function () {
|
143
|
|
- if (!this._map) {
|
144
|
|
- return this
|
145
|
|
- }
|
146
|
|
- var prevLeft = this._leftLayer
|
147
|
|
- var prevRight = this._rightLayer
|
148
|
|
- this._leftLayer = this._rightLayer = null
|
149
|
|
- this._leftLayers.forEach(function (layer) {
|
150
|
|
- if (this._map.hasLayer(layer)) {
|
151
|
|
- this._leftLayer = layer
|
152
|
|
- }
|
153
|
|
- }, this)
|
154
|
|
- this._rightLayers.forEach(function (layer) {
|
155
|
|
- if (this._map.hasLayer(layer)) {
|
156
|
|
- this._rightLayer = layer
|
157
|
|
- }
|
158
|
|
- }, this)
|
159
|
|
- if (prevLeft !== this._leftLayer) {
|
160
|
|
- prevLeft && this.fire('leftlayerremove', {layer: prevLeft})
|
161
|
|
- this._leftLayer && this.fire('leftlayeradd', {layer: this._leftLayer})
|
162
|
|
- }
|
163
|
|
- if (prevRight !== this._rightLayer) {
|
164
|
|
- prevRight && this.fire('rightlayerremove', {layer: prevRight})
|
165
|
|
- this._rightLayer && this.fire('rightlayeradd', {layer: this._rightLayer})
|
166
|
|
- }
|
167
|
|
- this._updateClip()
|
168
|
|
- },
|
169
|
|
-
|
170
|
|
- _addEvents: function () {
|
171
|
|
- var range = this._range
|
172
|
|
- var map = this._map
|
173
|
|
- if (!map || !range) return
|
174
|
|
- map.on('move', this._updateClip, this)
|
175
|
|
- map.on('layeradd layerremove', this._updateLayers, this)
|
176
|
|
- on(range, getRangeEvent(range), this._updateClip, this)
|
177
|
|
- on(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
|
178
|
|
- on(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
|
179
|
|
- },
|
180
|
|
-
|
181
|
|
- _removeEvents: function () {
|
182
|
|
- var range = this._range
|
183
|
|
- var map = this._map
|
184
|
|
- if (range) {
|
185
|
|
- off(range, getRangeEvent(range), this._updateClip, this)
|
186
|
|
- off(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
|
187
|
|
- off(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
|
188
|
|
- }
|
189
|
|
- if (map) {
|
190
|
|
- map.off('layeradd layerremove', this._updateLayers, this)
|
191
|
|
- map.off('move', this._updateClip, this)
|
192
|
|
- }
|
193
|
|
- }
|
194
|
|
-})
|
195
|
|
-
|
196
|
|
-L.control.sideBySide = function (leftLayers, rightLayers, options) {
|
197
|
|
- return new L.Control.SideBySide(leftLayers, rightLayers, options)
|
198
|
|
-}
|
199
|
|
-
|
200
|
|
-module.exports = L.Control.SideBySide
|
201
|
|
-
|
202
|
|
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
203
|
|
-},{"./layout.css":2,"./range.css":4}],2:[function(require,module,exports){
|
204
|
|
-var inject = require('./node_modules/cssify');
|
205
|
|
-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";
|
206
|
|
-inject(css, undefined, '_i6aomd');
|
207
|
|
-module.exports = css;
|
208
|
|
-
|
209
|
|
-},{"./node_modules/cssify":3}],3:[function(require,module,exports){
|
210
|
|
-'use strict'
|
211
|
|
-
|
212
|
|
-function injectStyleTag (document, fileName, cb) {
|
213
|
|
- var style = document.getElementById(fileName)
|
214
|
|
-
|
215
|
|
- if (style) {
|
216
|
|
- cb(style)
|
217
|
|
- } else {
|
218
|
|
- var head = document.getElementsByTagName('head')[0]
|
219
|
|
-
|
220
|
|
- style = document.createElement('style')
|
221
|
|
- if (fileName != null) style.id = fileName
|
222
|
|
- cb(style)
|
223
|
|
- head.appendChild(style)
|
224
|
|
- }
|
225
|
|
-
|
226
|
|
- return style
|
227
|
|
-}
|
228
|
|
-
|
229
|
|
-module.exports = function (css, customDocument, fileName) {
|
230
|
|
- var doc = customDocument || document
|
231
|
|
- /* istanbul ignore if: not supported by Electron */
|
232
|
|
- if (doc.createStyleSheet) {
|
233
|
|
- var sheet = doc.createStyleSheet()
|
234
|
|
- sheet.cssText = css
|
235
|
|
- return sheet.ownerNode
|
236
|
|
- } else {
|
237
|
|
- return injectStyleTag(doc, fileName, function (style) {
|
238
|
|
- /* istanbul ignore if: not supported by Electron */
|
239
|
|
- if (style.styleSheet) {
|
240
|
|
- style.styleSheet.cssText = css
|
241
|
|
- } else {
|
242
|
|
- style.innerHTML = css
|
243
|
|
- }
|
244
|
|
- })
|
245
|
|
- }
|
246
|
|
-}
|
247
|
|
-
|
248
|
|
-module.exports.byUrl = function (url) {
|
249
|
|
- /* istanbul ignore if: not supported by Electron */
|
250
|
|
- if (document.createStyleSheet) {
|
251
|
|
- return document.createStyleSheet(url).ownerNode
|
252
|
|
- } else {
|
253
|
|
- var head = document.getElementsByTagName('head')[0]
|
254
|
|
- var link = document.createElement('link')
|
255
|
|
-
|
256
|
|
- link.rel = 'stylesheet'
|
257
|
|
- link.href = url
|
258
|
|
-
|
259
|
|
- head.appendChild(link)
|
260
|
|
- return link
|
261
|
|
- }
|
262
|
|
-}
|
263
|
|
-
|
264
|
|
-},{}],4:[function(require,module,exports){
|
265
|
|
-var inject = require('./node_modules/cssify');
|
266
|
|
-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";
|
267
|
|
-inject(css, undefined, '_1tlt668');
|
268
|
|
-module.exports = css;
|
269
|
|
-
|
270
|
|
-},{"./node_modules/cssify":3}]},{},[1]);
|
|
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
|
+
|
|
7
|
+var mapWasDragEnabled
|
|
8
|
+var mapWasTapEnabled
|
|
9
|
+
|
|
10
|
+// Leaflet v0.7 backwards compatibility
|
|
11
|
+function on (el, types, fn, context) {
|
|
12
|
+ types.split(' ').forEach(function (type) {
|
|
13
|
+ L.DomEvent.on(el, type, fn, context)
|
|
14
|
+ })
|
|
15
|
+}
|
|
16
|
+
|
|
17
|
+// Leaflet v0.7 backwards compatibility
|
|
18
|
+function off (el, types, fn, context) {
|
|
19
|
+ types.split(' ').forEach(function (type) {
|
|
20
|
+ L.DomEvent.off(el, type, fn, context)
|
|
21
|
+ })
|
|
22
|
+}
|
|
23
|
+
|
|
24
|
+function getRangeEvent (rangeInput) {
|
|
25
|
+ return 'oninput' in rangeInput ? 'input' : 'change'
|
|
26
|
+}
|
|
27
|
+
|
|
28
|
+function cancelMapDrag () {
|
|
29
|
+ mapWasDragEnabled = this._map.dragging.enabled()
|
|
30
|
+ mapWasTapEnabled = this._map.tap && this._map.tap.enabled()
|
|
31
|
+ this._map.dragging.disable()
|
|
32
|
+ this._map.tap && this._map.tap.disable()
|
|
33
|
+}
|
|
34
|
+
|
|
35
|
+function uncancelMapDrag (e) {
|
|
36
|
+ this._refocusOnMap(e)
|
|
37
|
+ if (mapWasDragEnabled) {
|
|
38
|
+ this._map.dragging.enable()
|
|
39
|
+ }
|
|
40
|
+ if (mapWasTapEnabled) {
|
|
41
|
+ this._map.tap.enable()
|
|
42
|
+ }
|
|
43
|
+}
|
|
44
|
+
|
|
45
|
+// convert arg to an array - returns empty array if arg is undefined
|
|
46
|
+function asArray (arg) {
|
|
47
|
+ return (arg === 'undefined') ? [] : Array.isArray(arg) ? arg : [arg]
|
|
48
|
+}
|
|
49
|
+
|
|
50
|
+function noop () {}
|
|
51
|
+
|
|
52
|
+L.Control.SideBySide = L.Control.extend({
|
|
53
|
+ options: {
|
|
54
|
+ thumbSize: 42,
|
|
55
|
+ padding: 0
|
|
56
|
+ },
|
|
57
|
+
|
|
58
|
+ initialize: function (leftLayers, rightLayers, options) {
|
|
59
|
+ this.setLeftLayers(leftLayers)
|
|
60
|
+ this.setRightLayers(rightLayers)
|
|
61
|
+ L.setOptions(this, options)
|
|
62
|
+ },
|
|
63
|
+
|
|
64
|
+ getPosition: function () {
|
|
65
|
+ var rangeValue = this._range.value
|
|
66
|
+ var offset = (0.5 - rangeValue) * (2 * this.options.padding + this.options.thumbSize)
|
|
67
|
+ return this._map.getSize().x * rangeValue + offset
|
|
68
|
+ },
|
|
69
|
+
|
|
70
|
+ setPosition: noop,
|
|
71
|
+
|
|
72
|
+ includes: L.Evented.prototype || L.Mixin.Events,
|
|
73
|
+
|
|
74
|
+ addTo: function (map) {
|
|
75
|
+ this.remove()
|
|
76
|
+ this._map = map
|
|
77
|
+
|
|
78
|
+ var container = this._container = L.DomUtil.create('div', 'leaflet-sbs', map._controlContainer)
|
|
79
|
+
|
|
80
|
+ this._divider = L.DomUtil.create('div', 'leaflet-sbs-divider', container)
|
|
81
|
+ var range = this._range = L.DomUtil.create('input', 'leaflet-sbs-range', container)
|
|
82
|
+ range.type = 'range'
|
|
83
|
+ range.min = 0
|
|
84
|
+ range.max = 1
|
|
85
|
+ range.step = 'any'
|
|
86
|
+ range.value = 0.5
|
|
87
|
+ range.style.paddingLeft = range.style.paddingRight = this.options.padding + 'px'
|
|
88
|
+ this._addEvents()
|
|
89
|
+ this._updateLayers()
|
|
90
|
+ return this
|
|
91
|
+ },
|
|
92
|
+
|
|
93
|
+ remove: function () {
|
|
94
|
+ if (!this._map) {
|
|
95
|
+ return this
|
|
96
|
+ }
|
|
97
|
+ if (this._leftLayer) {
|
|
98
|
+ this._leftLayer.getContainer().style.clip = ''
|
|
99
|
+ }
|
|
100
|
+ if (this._rightLayer) {
|
|
101
|
+ this._rightLayer.getContainer().style.clip = ''
|
|
102
|
+ }
|
|
103
|
+ this._removeEvents()
|
|
104
|
+ L.DomUtil.remove(this._container)
|
|
105
|
+
|
|
106
|
+ this._map = null
|
|
107
|
+
|
|
108
|
+ return this
|
|
109
|
+ },
|
|
110
|
+
|
|
111
|
+ setLeftLayers: function (leftLayers) {
|
|
112
|
+ this._leftLayers = asArray(leftLayers)
|
|
113
|
+ this._updateLayers()
|
|
114
|
+ return this
|
|
115
|
+ },
|
|
116
|
+
|
|
117
|
+ setRightLayers: function (rightLayers) {
|
|
118
|
+ this._rightLayers = asArray(rightLayers)
|
|
119
|
+ this._updateLayers()
|
|
120
|
+ return this
|
|
121
|
+ },
|
|
122
|
+
|
|
123
|
+ _updateClip: function () {
|
|
124
|
+ var map = this._map
|
|
125
|
+ var nw = map.containerPointToLayerPoint([0, 0])
|
|
126
|
+ var se = map.containerPointToLayerPoint(map.getSize())
|
|
127
|
+ var clipX = nw.x + this.getPosition()
|
|
128
|
+ var dividerX = this.getPosition()
|
|
129
|
+
|
|
130
|
+ this._divider.style.left = dividerX + 'px'
|
|
131
|
+ this.fire('dividermove', {x: dividerX})
|
|
132
|
+ var clipLeft = 'rect(' + [nw.y, clipX, se.y, nw.x].join('px,') + 'px)'
|
|
133
|
+ var clipRight = 'rect(' + [nw.y, se.x, se.y, clipX].join('px,') + 'px)'
|
|
134
|
+ if (this._leftLayer) {
|
|
135
|
+ this._leftLayer.getContainer().style.clip = clipLeft
|
|
136
|
+ }
|
|
137
|
+ if (this._rightLayer) {
|
|
138
|
+ this._rightLayer.getContainer().style.clip = clipRight
|
|
139
|
+ }
|
|
140
|
+ },
|
|
141
|
+
|
|
142
|
+ _updateLayers: function () {
|
|
143
|
+ if (!this._map) {
|
|
144
|
+ return this
|
|
145
|
+ }
|
|
146
|
+ var prevLeft = this._leftLayer
|
|
147
|
+ var prevRight = this._rightLayer
|
|
148
|
+ this._leftLayer = this._rightLayer = null
|
|
149
|
+ this._leftLayers.forEach(function (layer) {
|
|
150
|
+ if (this._map.hasLayer(layer)) {
|
|
151
|
+ this._leftLayer = layer
|
|
152
|
+ }
|
|
153
|
+ }, this)
|
|
154
|
+ this._rightLayers.forEach(function (layer) {
|
|
155
|
+ if (this._map.hasLayer(layer)) {
|
|
156
|
+ this._rightLayer = layer
|
|
157
|
+ }
|
|
158
|
+ }, this)
|
|
159
|
+ if (prevLeft !== this._leftLayer) {
|
|
160
|
+ prevLeft && this.fire('leftlayerremove', {layer: prevLeft})
|
|
161
|
+ this._leftLayer && this.fire('leftlayeradd', {layer: this._leftLayer})
|
|
162
|
+ }
|
|
163
|
+ if (prevRight !== this._rightLayer) {
|
|
164
|
+ prevRight && this.fire('rightlayerremove', {layer: prevRight})
|
|
165
|
+ this._rightLayer && this.fire('rightlayeradd', {layer: this._rightLayer})
|
|
166
|
+ }
|
|
167
|
+ this._updateClip()
|
|
168
|
+ },
|
|
169
|
+
|
|
170
|
+ _addEvents: function () {
|
|
171
|
+ var range = this._range
|
|
172
|
+ var map = this._map
|
|
173
|
+ if (!map || !range) return
|
|
174
|
+ map.on('move', this._updateClip, this)
|
|
175
|
+ map.on('layeradd layerremove', this._updateLayers, this)
|
|
176
|
+ on(range, getRangeEvent(range), this._updateClip, this)
|
|
177
|
+ on(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
|
|
178
|
+ on(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
|
|
179
|
+ },
|
|
180
|
+
|
|
181
|
+ _removeEvents: function () {
|
|
182
|
+ var range = this._range
|
|
183
|
+ var map = this._map
|
|
184
|
+ if (range) {
|
|
185
|
+ off(range, getRangeEvent(range), this._updateClip, this)
|
|
186
|
+ off(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
|
|
187
|
+ off(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
|
|
188
|
+ }
|
|
189
|
+ if (map) {
|
|
190
|
+ map.off('layeradd layerremove', this._updateLayers, this)
|
|
191
|
+ map.off('move', this._updateClip, this)
|
|
192
|
+ }
|
|
193
|
+ }
|
|
194
|
+})
|
|
195
|
+
|
|
196
|
+L.control.sideBySide = function (leftLayers, rightLayers, options) {
|
|
197
|
+ return new L.Control.SideBySide(leftLayers, rightLayers, options)
|
|
198
|
+}
|
|
199
|
+
|
|
200
|
+module.exports = L.Control.SideBySide
|
|
201
|
+
|
|
202
|
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
203
|
+},{"./layout.css":2,"./range.css":4}],2:[function(require,module,exports){
|
|
204
|
+var inject = require('./node_modules/cssify');
|
|
205
|
+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";
|
|
206
|
+inject(css, undefined, '_i6aomd');
|
|
207
|
+module.exports = css;
|
|
208
|
+
|
|
209
|
+},{"./node_modules/cssify":3}],3:[function(require,module,exports){
|
|
210
|
+'use strict'
|
|
211
|
+
|
|
212
|
+function injectStyleTag (document, fileName, cb) {
|
|
213
|
+ var style = document.getElementById(fileName)
|
|
214
|
+
|
|
215
|
+ if (style) {
|
|
216
|
+ cb(style)
|
|
217
|
+ } else {
|
|
218
|
+ var head = document.getElementsByTagName('head')[0]
|
|
219
|
+
|
|
220
|
+ style = document.createElement('style')
|
|
221
|
+ if (fileName != null) style.id = fileName
|
|
222
|
+ cb(style)
|
|
223
|
+ head.appendChild(style)
|
|
224
|
+ }
|
|
225
|
+
|
|
226
|
+ return style
|
|
227
|
+}
|
|
228
|
+
|
|
229
|
+module.exports = function (css, customDocument, fileName) {
|
|
230
|
+ var doc = customDocument || document
|
|
231
|
+ /* istanbul ignore if: not supported by Electron */
|
|
232
|
+ if (doc.createStyleSheet) {
|
|
233
|
+ var sheet = doc.createStyleSheet()
|
|
234
|
+ sheet.cssText = css
|
|
235
|
+ return sheet.ownerNode
|
|
236
|
+ } else {
|
|
237
|
+ return injectStyleTag(doc, fileName, function (style) {
|
|
238
|
+ /* istanbul ignore if: not supported by Electron */
|
|
239
|
+ if (style.styleSheet) {
|
|
240
|
+ style.styleSheet.cssText = css
|
|
241
|
+ } else {
|
|
242
|
+ style.innerHTML = css
|
|
243
|
+ }
|
|
244
|
+ })
|
|
245
|
+ }
|
|
246
|
+}
|
|
247
|
+
|
|
248
|
+module.exports.byUrl = function (url) {
|
|
249
|
+ /* istanbul ignore if: not supported by Electron */
|
|
250
|
+ if (document.createStyleSheet) {
|
|
251
|
+ return document.createStyleSheet(url).ownerNode
|
|
252
|
+ } else {
|
|
253
|
+ var head = document.getElementsByTagName('head')[0]
|
|
254
|
+ var link = document.createElement('link')
|
|
255
|
+
|
|
256
|
+ link.rel = 'stylesheet'
|
|
257
|
+ link.href = url
|
|
258
|
+
|
|
259
|
+ head.appendChild(link)
|
|
260
|
+ return link
|
|
261
|
+ }
|
|
262
|
+}
|
|
263
|
+
|
|
264
|
+},{}],4:[function(require,module,exports){
|
|
265
|
+var inject = require('./node_modules/cssify');
|
|
266
|
+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";
|
|
267
|
+inject(css, undefined, '_1tlt668');
|
|
268
|
+module.exports = css;
|
|
269
|
+
|
|
270
|
+},{"./node_modules/cssify":3}]},{},[1]);
|