From 0435153dae270016cc49e2ffcdc27840a17adc5c Mon Sep 17 00:00:00 2001 From: Brian Geyer <5496867+geyerbri@users.noreply.github.com> Date: Sat, 26 Sep 2020 15:38:10 -0400 Subject: [PATCH 1/2] fix ordering to apply to variations of json data using "features" instead of "feature" limits the applicability of the chronological ordering functionality. --- src/SliderControl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SliderControl.js b/src/SliderControl.js index 4a7906f..291489e 100644 --- a/src/SliderControl.js +++ b/src/SliderControl.js @@ -56,12 +56,12 @@ L.Control.SliderControl = L.Control.extend({ var valA = null; var valB = null; - if(a.features && a.features.properties && a.feature.properties[options.timeAttribute]){ + if(a.feature && a.feature.properties && a.feature.properties[options.timeAttribute]){ valA = a.feature.properties[options.timeAttribute]; }else if(a.options[options.timeAttribute]){ valA = a.options[options.timeAttribute]; } - if(b.features && b.features.properties && b.feature.properties[options.timeAttribute]){ + if(b.feature && b.feature.properties && b.feature.properties[options.timeAttribute]){ valB = b.feature.properties[options.timeAttribute]; }else if(b.options[options.timeAttribute]){ valB = b.options[options.timeAttribute]; From 530050e3d98b99a33c753d63b32bf55f38485dab Mon Sep 17 00:00:00 2001 From: Brian Geyer <5496867+geyerbri@users.noreply.github.com> Date: Sat, 26 Sep 2020 15:40:22 -0400 Subject: [PATCH 2/2] min fix ordering to apply to variations of json data --- dist/leaflet.SliderControl.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/leaflet.SliderControl.min.js b/dist/leaflet.SliderControl.min.js index 9da4673..cc92a71 100644 --- a/dist/leaflet.SliderControl.min.js +++ b/dist/leaflet.SliderControl.min.js @@ -1 +1 @@ -L.Control.SliderControl=L.Control.extend({options:{position:"topright",layer:null,timeAttribute:"time",isEpoch:!1,startTimeIdx:0,timeStrLength:19,maxValue:-1,minValue:0,showAllOnStart:!1,markers:null,range:!1,follow:0,sameDate:!1,alwaysShowDate:!1,rezoom:null,orderMarkers:!0,orderDesc:!1,popupOptions:{},popupContent:"",showAllPopups:!0,showPopups:!0},initialize:function(e){L.Util.setOptions(this,e),this._layer=this.options.layer,L.extend(this,L.Mixin.Events)},onAdd:function(e){this.options.map=e,this.container=L.DomUtil.create("div","",this._container),this.sliderBoxContainer=L.DomUtil.create("div","slider",this.container);var t=L.DomUtil.create("div","",this.sliderBoxContainer);t.id="leaflet-slider",t.style.width="200px",L.DomUtil.create("div","ui-slider-handle",t),this.timestampContainer=L.DomUtil.create("div","slider",this.container),this.timestampContainer.id="slider-timestamp",this.timestampContainer.style.cssText="width:200px; margin-top:3px; background-color:#FFFFFF; text-align:center; border-radius:5px;display:none;",L.DomEvent.disableClickPropagation(this.sliderBoxContainer),this._map.on("mouseup",this.clearTimestamp,this);var o=this.options;if(this.options.markers=[],this._layer){var r=0,i=[];this._layer.eachLayer(function(e){i.push(e)}),o.orderMarkers&&(i=i.sort(function(e,t){var r=null,i=null;if(e.features&&e.features.properties&&e.feature.properties[o.timeAttribute]?r=e.feature.properties[o.timeAttribute]:e.options[o.timeAttribute]&&(r=e.options[o.timeAttribute]),t.features&&t.features.properties&&t.feature.properties[o.timeAttribute]?i=t.feature.properties[o.timeAttribute]:t.options[o.timeAttribute]&&(i=t.options[o.timeAttribute]),r&&i){if(r