From a06a0a671e1a88707ef7a79a8f7f08d73575c7bc Mon Sep 17 00:00:00 2001 From: Goutte Date: Wed, 12 Jul 2017 20:01:20 +0200 Subject: [PATCH] Prepare the time domain for the future download button. --- web/static/js/swapp.js | 8 ++++++++ web/static/js/swapp.ls | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/web/static/js/swapp.js b/web/static/js/swapp.js index aab9d90..b846ca0 100644 --- a/web/static/js/swapp.js +++ b/web/static/js/swapp.js @@ -236,6 +236,12 @@ }); return this; }; + SpaceWeather.prototype.getDomain = function(){ + if (this.current_started_at != null && this.current_stopped_at != null) { + return [this.current_started_at, this.current_stopped_at]; + } + return [this.started_at, this.stopped_at]; + }; SpaceWeather.prototype.resizeDomain = function(started_at, stopped_at){ var tmp; if (stopped_at < started_at) { @@ -247,6 +253,8 @@ console.warn("Please provide distinct start and stop dates."); return; } + this.current_started_at = started_at; + this.current_stopped_at = stopped_at; if ((this.started_at <= started_at && started_at <= this.stopped_at) && (this.started_at <= stopped_at && stopped_at <= this.stopped_at)) { console.info("Resizing the temporal domain from " + started_at + " to " + stopped_at + " without fetching new data…"); timeSeries.forEach(function(ts){ diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls index da0f325..55e43dc 100644 --- a/web/static/js/swapp.ls +++ b/web/static/js/swapp.ls @@ -189,6 +189,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE timeSeries.forEach((ts) -> ts.hide() if ts.parameter == parameter_slug) this + getDomain: -> + if @current_started_at? and @current_stopped_at? + return [@current_started_at, @current_stopped_at] + return [@started_at, @stopped_at] + resizeDomain: (started_at, stopped_at) -> if stopped_at < started_at tmp = started_at @@ -199,11 +204,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE console.warn "Please provide distinct start and stop dates." return + @current_started_at = started_at + @current_stopped_at = stopped_at + if (@started_at <= started_at <= @stopped_at) and (@started_at <= stopped_at <= @stopped_at) then console.info "Resizing the temporal domain from #{started_at} to #{stopped_at} without fetching new data…" # We first resize the hidden time series and only afterwards we resize - # the visible ones, for a smoother transition + # the visible ones, for a smoother transition. timeSeries.forEach((ts) -> if not ts.visible then ts.zoomIn(started_at, stopped_at)) timeSeries.forEach((ts) -> if ts.visible then ts.zoomIn(started_at, stopped_at)) @orbits.resizeDomain started_at, stopped_at -- libgit2 0.21.2