Skip to content

Commit c2be2e4

Browse files
authored
Merge pull request #45 from rabbl/sameDate
Add option sameTime to show all layers with equal timestrings
2 parents cc52caa + fc2bd94 commit c2be2e4

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

SliderControl.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ L.Control.SliderControl = L.Control.extend({
1212
markers: null,
1313
range: false,
1414
follow: false,
15+
sameDate: false,
1516
alwaysShowDate : false,
1617
rezoom: null
1718
},
@@ -104,6 +105,7 @@ L.Control.SliderControl = L.Control.extend({
104105
values: _options.values,
105106
min: _options.minValue,
106107
max: _options.maxValue,
108+
sameDate: _options.sameDate,
107109
step: 1,
108110
slide: function (e, ui) {
109111
var map = _options.map;
@@ -147,6 +149,16 @@ L.Control.SliderControl = L.Control.extend({
147149
fg.addLayer(_options.markers[i]);
148150
}
149151
}
152+
}else if(_options.sameDate){
153+
var currentTime;
154+
if (_options.markers[ui.value].feature !== undefined) {
155+
currentTime = _options.markers[ui.value].feature.properties.time;
156+
} else {
157+
currentTime = _options.markers[ui.value].options.time;
158+
}
159+
for (i = _options.minValue; i <= _options.maxValue; i++) {
160+
if(_options.markers[i].options.time == currentTime) map.addLayer(_options.markers[i]);
161+
}
150162
}else{
151163
for (i = _options.minValue; i <= ui.value ; i++) {
152164
if(_options.markers[i]) {

0 commit comments

Comments
 (0)