|
@@ -13,6 +13,7 @@ function on (el, types, fn, context) {
|
13
|
13
|
})
|
14
|
14
|
}
|
15
|
15
|
|
|
16
|
+// Leaflet v0.7 backwards compatibility
|
16
|
17
|
function off (el, types, fn, context) {
|
17
|
18
|
types.split(' ').forEach(function (type) {
|
18
|
19
|
L.DomEvent.off(el, type, fn, context)
|
|
@@ -48,6 +49,8 @@ L.Control.SideBySide = L.Control.extend({
|
48
|
49
|
|
49
|
50
|
setPosition: noop,
|
50
|
51
|
|
|
52
|
+ includes: L.Mixin.Events,
|
|
53
|
+
|
51
|
54
|
addTo: function (map) {
|
52
|
55
|
this.remove()
|
53
|
56
|
this._map = map
|
|
@@ -60,6 +63,7 @@ L.Control.SideBySide = L.Control.extend({
|
60
|
63
|
range.min = 0
|
61
|
64
|
range.max = 1
|
62
|
65
|
range.step = 'any'
|
|
66
|
+ range.value = 0.5
|
63
|
67
|
this._addEvents()
|
64
|
68
|
this._updateLayers()
|
65
|
69
|
this._updateClip()
|
|
@@ -85,8 +89,10 @@ L.Control.SideBySide = L.Control.extend({
|
85
|
89
|
var se = map.containerPointToLayerPoint(map.getSize())
|
86
|
90
|
var offset = (0.5 - rangeValue) * 44
|
87
|
91
|
var clipX = nw.x + (se.x - nw.x) * rangeValue + offset
|
|
92
|
+ var dividerX = map.getSize().x * rangeValue + offset
|
88
|
93
|
|
89
|
|
- this._divider.style.left = map.getSize().x * rangeValue + offset + 'px'
|
|
94
|
+ this._divider.style.left = dividerX + 'px'
|
|
95
|
+ this.fire('dividermove', {x: dividerX})
|
90
|
96
|
var clipLeft = 'rect(' + [nw.y, clipX, se.y, nw.x].join('px,') + 'px)'
|
91
|
97
|
var clipRight = 'rect(' + [nw.y, se.x, se.y, clipX].join('px,') + 'px)'
|
92
|
98
|
if (this._leftLayer) {
|
|
@@ -98,13 +104,27 @@ L.Control.SideBySide = L.Control.extend({
|
98
|
104
|
},
|
99
|
105
|
|
100
|
106
|
_updateLayers: function () {
|
|
107
|
+ var prevLeft = this._leftLayer
|
|
108
|
+ var prevRight = this._rightLayer
|
101
|
109
|
this._leftLayer = this._rightLayer = null
|
102
|
110
|
this._leftLayers.forEach(function (layer) {
|
103
|
|
- if (this._map.hasLayer(layer)) this._leftLayer = layer
|
|
111
|
+ if (this._map.hasLayer(layer)) {
|
|
112
|
+ this._leftLayer = layer
|
|
113
|
+ }
|
104
|
114
|
}, this)
|
105
|
115
|
this._rightLayers.forEach(function (layer) {
|
106
|
|
- if (this._map.hasLayer(layer)) this._rightLayer = layer
|
|
116
|
+ if (this._map.hasLayer(layer)) {
|
|
117
|
+ this._rightLayer = layer
|
|
118
|
+ }
|
107
|
119
|
}, this)
|
|
120
|
+ if (prevLeft !== this._leftLayer) {
|
|
121
|
+ prevLeft && this.fire('leftlayerremove', {layer: prevLeft})
|
|
122
|
+ this._leftLayer && this.fire('leftlayeradd', {layer: this._leftLayer})
|
|
123
|
+ }
|
|
124
|
+ if (prevRight !== this._rightLayer) {
|
|
125
|
+ prevRight && this.fire('rightlayerremove', {layer: prevRight})
|
|
126
|
+ this._rightLayer && this.fire('rightlayeradd', {layer: this._rightLayer})
|
|
127
|
+ }
|
108
|
128
|
this._updateClip()
|
109
|
129
|
},
|
110
|
130
|
|
|
@@ -194,5 +214,5 @@ module.exports.byUrl = function(url) {
|
194
|
214
|
};
|
195
|
215
|
|
196
|
216
|
},{}],4:[function(require,module,exports){
|
197
|
|
-var css = ".leaflet-sbs-range,\n.leaflet-sbs-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n margin: 0;\n padding: 0;\n border: 0;\n}\n.leaflet-sbs-range {\n display: inline-block!important;\n vertical-align: middle;\n height: 0;\n padding: 0;\n margin: 0;\n border: 0;\n background: rgba(0, 0, 0, 0.25);\n min-width: 100px;\n cursor: pointer;\n pointer-events: none;\n z-index: 999;\n}\n.leaflet-sbs-range::-ms-fill-upper {\n background: transparent;\n}\n.leaflet-sbs-range::-ms-fill-lower {\n background: rgba(255, 255, 255, 0.25);\n}\n/* Browser thingies */\n\n.leaflet-sbs-range::-moz-range-track {\n opacity: 0;\n}\n.leaflet-sbs-range::-ms-track {\n opacity: 0;\n}\n.leaflet-sbs-range::-ms-tooltip {\n display: none;\n}\n/* For whatever reason, these need to be defined\n * on their own so dont group them */\n\n.leaflet-sbs-range::-webkit-slider-thumb {\n background: #fff;\n height: 40px;\n width: 40px;\n border-radius: 20px;\n cursor: ew-resize;\n pointer-events: auto;\n border: 1px solid #ddd;\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: 40px 40px;\n}\n.leaflet-sbs-range::-ms-thumb {\n margin: 0;\n padding: 0;\n background: #fff;\n height: 40px;\n width: 40px;\n border-radius: 20px;\n cursor: ew-resize;\n pointer-events: auto;\n border: 1px solid #ddd;\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: 40px 40px;\n}\n.leaflet-sbs-range::-moz-range-thumb {\n padding: 0;\n right: 0 ;\n background: #fff;\n height: 40px;\n width: 40px;\n border-radius: 20px;\n cursor: ew-resize;\n pointer-events: auto;\n border: 1px solid #ddd;\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: 40px 40px;\n}\n.leaflet-sbs-range:disabled::-moz-range-thumb {\n cursor: default;\n}\n.leaflet-sbs-range:disabled::-ms-thumb {\n cursor: default;\n}\n.leaflet-sbs-range:disabled::-webkit-slider-thumb {\n cursor: default;\n}\n.leaflet-sbs-range:disabled {\n cursor: default;\n}\n.leaflet-sbs-range:focus {\n outline: none!important;\n}\n.leaflet-sbs-range::-moz-focus-outer {\n border: 0;\n}\n\n"; (require("./node_modules/cssify"))(css, undefined, '/Users/gregor/Dev/DdDev/leaflet-side-by-side/range.css'); module.exports = css;
|
|
217
|
+var css = ".leaflet-sbs-range {\n -webkit-appearance: none;\n display: inline-block!important;\n vertical-align: middle;\n height: 0;\n padding: 0;\n margin: 0;\n border: 0;\n background: rgba(0, 0, 0, 0.25);\n min-width: 100px;\n cursor: pointer;\n pointer-events: none;\n z-index: 999;\n}\n.leaflet-sbs-range::-ms-fill-upper {\n background: transparent;\n}\n.leaflet-sbs-range::-ms-fill-lower {\n background: rgba(255, 255, 255, 0.25);\n}\n/* Browser thingies */\n\n.leaflet-sbs-range::-moz-range-track {\n opacity: 0;\n}\n.leaflet-sbs-range::-ms-track {\n opacity: 0;\n}\n.leaflet-sbs-range::-ms-tooltip {\n display: none;\n}\n/* For whatever reason, these need to be defined\n * on their own so dont group them */\n\n.leaflet-sbs-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n margin: 0;\n padding: 0;\n background: #fff;\n height: 40px;\n width: 40px;\n border-radius: 20px;\n cursor: ew-resize;\n pointer-events: auto;\n border: 1px solid #ddd;\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: 40px 40px;\n}\n.leaflet-sbs-range::-ms-thumb {\n margin: 0;\n padding: 0;\n background: #fff;\n height: 40px;\n width: 40px;\n border-radius: 20px;\n cursor: ew-resize;\n pointer-events: auto;\n border: 1px solid #ddd;\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: 40px 40px;\n}\n.leaflet-sbs-range::-moz-range-thumb {\n padding: 0;\n right: 0 ;\n background: #fff;\n height: 40px;\n width: 40px;\n border-radius: 20px;\n cursor: ew-resize;\n pointer-events: auto;\n border: 1px solid #ddd;\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABlBMVEV9fX3///+Kct39AAAAAnRSTlP/AOW3MEoAAAA9SURBVFjD7dehDQAwDANBZ/+l2wmKoiqR7pHRcaeaCxAIBAL/g7k9JxAIBAKBQCAQCAQC14H+MhAIBE4CD3fOFvGVBzhZAAAAAElFTkSuQmCC\");\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: 40px 40px;\n}\n.leaflet-sbs-range:disabled::-moz-range-thumb {\n cursor: default;\n}\n.leaflet-sbs-range:disabled::-ms-thumb {\n cursor: default;\n}\n.leaflet-sbs-range:disabled::-webkit-slider-thumb {\n cursor: default;\n}\n.leaflet-sbs-range:disabled {\n cursor: default;\n}\n.leaflet-sbs-range:focus {\n outline: none!important;\n}\n.leaflet-sbs-range::-moz-focus-outer {\n border: 0;\n}\n\n"; (require("./node_modules/cssify"))(css, undefined, '/Users/gregor/Dev/DdDev/leaflet-side-by-side/range.css'); module.exports = css;
|
198
|
218
|
},{"./node_modules/cssify":3}]},{},[1]);
|