|
@@ -61,7 +61,11 @@ L.Control.SideBySide = L.Control.extend({
|
61
|
61
|
L.setOptions(this, options)
|
62
|
62
|
},
|
63
|
63
|
|
64
|
|
- getPosition: noop,
|
|
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
|
+ },
|
65
|
69
|
|
66
|
70
|
setPosition: noop,
|
67
|
71
|
|
|
@@ -112,12 +116,10 @@ L.Control.SideBySide = L.Control.extend({
|
112
|
116
|
|
113
|
117
|
_updateClip: function () {
|
114
|
118
|
var map = this._map
|
115
|
|
- var rangeValue = this._range.value
|
116
|
119
|
var nw = map.containerPointToLayerPoint([0, 0])
|
117
|
120
|
var se = map.containerPointToLayerPoint(map.getSize())
|
118
|
|
- var offset = (0.5 - rangeValue) * (2 * this.options.padding + this.options.thumbSize)
|
119
|
|
- var clipX = nw.x + (se.x - nw.x) * rangeValue + offset
|
120
|
|
- var dividerX = map.getSize().x * rangeValue + offset
|
|
121
|
+ var clipX = nw.x + this.getPosition()
|
|
122
|
+ var dividerX = this.getPosition()
|
121
|
123
|
|
122
|
124
|
this._divider.style.left = dividerX + 'px'
|
123
|
125
|
this.fire('dividermove', {x: dividerX})
|