Skip to content

Commit

Permalink
Merge pull request #45 from rabbl/sameDate
Browse files Browse the repository at this point in the history
Add option sameTime to show all layers with equal timestrings
  • Loading branch information
dwilhelm89 authored Sep 21, 2017
2 parents cc52caa + fc2bd94 commit c2be2e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SliderControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ L.Control.SliderControl = L.Control.extend({
markers: null,
range: false,
follow: false,
sameDate: false,
alwaysShowDate : false,
rezoom: null
},
Expand Down Expand Up @@ -104,6 +105,7 @@ L.Control.SliderControl = L.Control.extend({
values: _options.values,
min: _options.minValue,
max: _options.maxValue,
sameDate: _options.sameDate,
step: 1,
slide: function (e, ui) {
var map = _options.map;
Expand Down Expand Up @@ -147,6 +149,16 @@ L.Control.SliderControl = L.Control.extend({
fg.addLayer(_options.markers[i]);
}
}
}else if(_options.sameDate){
var currentTime;
if (_options.markers[ui.value].feature !== undefined) {
currentTime = _options.markers[ui.value].feature.properties.time;
} else {
currentTime = _options.markers[ui.value].options.time;
}
for (i = _options.minValue; i <= _options.maxValue; i++) {
if(_options.markers[i].options.time == currentTime) map.addLayer(_options.markers[i]);
}
}else{
for (i = _options.minValue; i <= ui.value ; i++) {
if(_options.markers[i]) {
Expand Down

0 comments on commit c2be2e4

Please sign in to comment.