|
@@ -43,9 +43,15 @@ function noop () {
|
43
|
43
|
}
|
44
|
44
|
|
45
|
45
|
L.Control.SideBySide = L.Control.extend({
|
46
|
|
- initialize: function (leftLayers, rightLayers) {
|
|
46
|
+ options: {
|
|
47
|
+ thumbSize: 42,
|
|
48
|
+ padding: 0
|
|
49
|
+ },
|
|
50
|
+
|
|
51
|
+ initialize: function (leftLayers, rightLayers, options) {
|
47
|
52
|
this.setLeftLayers(leftLayers)
|
48
|
53
|
this.setRightLayers(rightLayers)
|
|
54
|
+ L.setOptions(this, options)
|
49
|
55
|
},
|
50
|
56
|
|
51
|
57
|
getPosition: noop,
|
|
@@ -67,6 +73,7 @@ L.Control.SideBySide = L.Control.extend({
|
67
|
73
|
range.max = 1
|
68
|
74
|
range.step = 'any'
|
69
|
75
|
range.value = 0.5
|
|
76
|
+ range.style.paddingLeft = range.style.paddingRight = this.options.padding + 'px'
|
70
|
77
|
this._addEvents()
|
71
|
78
|
this._updateLayers()
|
72
|
79
|
return this
|
|
@@ -101,7 +108,7 @@ L.Control.SideBySide = L.Control.extend({
|
101
|
108
|
var rangeValue = this._range.value
|
102
|
109
|
var nw = map.containerPointToLayerPoint([0, 0])
|
103
|
110
|
var se = map.containerPointToLayerPoint(map.getSize())
|
104
|
|
- var offset = (0.5 - rangeValue) * 44
|
|
111
|
+ var offset = (0.5 - rangeValue) * (2 * this.options.padding + this.options.thumbSize)
|
105
|
112
|
var clipX = nw.x + (se.x - nw.x) * rangeValue + offset
|
106
|
113
|
var dividerX = map.getSize().x * rangeValue + offset
|
107
|
114
|
|