diff --git a/components/sidebar/sidebaritem.js b/components/sidebar/sidebaritem.js index d6097b7..b7c3c2c 100644 --- a/components/sidebar/sidebaritem.js +++ b/components/sidebar/sidebaritem.js @@ -9,7 +9,7 @@ export default function Sidebaritem({service, options={}}={}){ return { layers, panel, - step: 1, + step: layers[0].options.step, format: 'YYYY-MM-DD HH:mm:ss', min_date: layers[0].start_date, max_date: layers[0].end_date, @@ -52,6 +52,7 @@ export default function Sidebaritem({service, options={}}={}){ */ initLayerTimeseries(){ this.status = 0; + this.min_date = this.layer.start_date; this.currentLayerDateTimeIndex = this.layer.start_date; this.range.value = 0; this.range.min = 0; diff --git a/service.js b/service.js index 0b36d89..8a75bda 100644 --- a/service.js +++ b/service.js @@ -171,7 +171,7 @@ function PluginService(){ this.addProjectLayerFromConfigProject = function(){ this.project.getConfigLayers().forEach(layerConfig => { if (toRawType(layerConfig.qtimeseries) === 'Object') { - let {field, duration=1, units='d', start_date=null, end_date=null} = layerConfig.qtimeseries; + let {field, step=1, units='d', start_date=null, end_date=null} = layerConfig.qtimeseries; const startDateTimeZoneOffset = new Date(start_date).getTimezoneOffset(); const endDateTimeZoneOffset = new Date(end_date).getTimezoneOffset(); start_date = moment(start_date).add(startDateTimeZoneOffset, 'minutes'); @@ -192,6 +192,7 @@ function PluginService(){ options: { range_max: moment(end_date).diff(moment(start_date), stepunit) - 1, format, + step, //added stepunit, stepunitmultiplier, field @@ -264,11 +265,11 @@ function PluginService(){ } }; - this.resetTimeLayer = function(layer){ + this.resetTimeLayer = function(layer, hideInfo=false){ return new Promise((resolve, reject) => { if (layer.timed){ const mapLayerToUpdate = this.mapService.getMapLayerByLayerId(layer.id); - mapLayerToUpdate.once('loadend', () => { + hideInfo && mapLayerToUpdate.once('loadend', () => { this.mapService.showMapInfo(); resolve(); }); @@ -292,7 +293,7 @@ function PluginService(){ */ this.close = function(){ const layer = this.state.layers.find(layer => layer.timed); - layer && this.resetTimeLayer(layer); + layer && this.resetTimeLayer(layer, true); this.state.panel.open = false; this.deactiveChartInteraction(); };