Commit a06a0a671e1a88707ef7a79a8f7f08d73575c7bc
1 parent
116197a0
Exists in
master
and in
2 other branches
Prepare the time domain for the future download button.
Showing
2 changed files
with
17 additions
and
1 deletions
Show diff stats
web/static/js/swapp.js
... | ... | @@ -236,6 +236,12 @@ |
236 | 236 | }); |
237 | 237 | return this; |
238 | 238 | }; |
239 | + SpaceWeather.prototype.getDomain = function(){ | |
240 | + if (this.current_started_at != null && this.current_stopped_at != null) { | |
241 | + return [this.current_started_at, this.current_stopped_at]; | |
242 | + } | |
243 | + return [this.started_at, this.stopped_at]; | |
244 | + }; | |
239 | 245 | SpaceWeather.prototype.resizeDomain = function(started_at, stopped_at){ |
240 | 246 | var tmp; |
241 | 247 | if (stopped_at < started_at) { |
... | ... | @@ -247,6 +253,8 @@ |
247 | 253 | console.warn("Please provide distinct start and stop dates."); |
248 | 254 | return; |
249 | 255 | } |
256 | + this.current_started_at = started_at; | |
257 | + this.current_stopped_at = stopped_at; | |
250 | 258 | if ((this.started_at <= started_at && started_at <= this.stopped_at) && (this.started_at <= stopped_at && stopped_at <= this.stopped_at)) { |
251 | 259 | console.info("Resizing the temporal domain from " + started_at + " to " + stopped_at + " without fetching new data…"); |
252 | 260 | timeSeries.forEach(function(ts){ | ... | ... |
web/static/js/swapp.ls
... | ... | @@ -189,6 +189,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE |
189 | 189 | timeSeries.forEach((ts) -> ts.hide() if ts.parameter == parameter_slug) |
190 | 190 | this |
191 | 191 | |
192 | + getDomain: -> | |
193 | + if @current_started_at? and @current_stopped_at? | |
194 | + return [@current_started_at, @current_stopped_at] | |
195 | + return [@started_at, @stopped_at] | |
196 | + | |
192 | 197 | resizeDomain: (started_at, stopped_at) -> |
193 | 198 | if stopped_at < started_at |
194 | 199 | tmp = started_at |
... | ... | @@ -199,11 +204,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE |
199 | 204 | console.warn "Please provide distinct start and stop dates." |
200 | 205 | return |
201 | 206 | |
207 | + @current_started_at = started_at | |
208 | + @current_stopped_at = stopped_at | |
209 | + | |
202 | 210 | if (@started_at <= started_at <= @stopped_at) and |
203 | 211 | (@started_at <= stopped_at <= @stopped_at) then |
204 | 212 | console.info "Resizing the temporal domain from #{started_at} to #{stopped_at} without fetching new data…" |
205 | 213 | # We first resize the hidden time series and only afterwards we resize |
206 | - # the visible ones, for a smoother transition | |
214 | + # the visible ones, for a smoother transition. | |
207 | 215 | timeSeries.forEach((ts) -> if not ts.visible then ts.zoomIn(started_at, stopped_at)) |
208 | 216 | timeSeries.forEach((ts) -> if ts.visible then ts.zoomIn(started_at, stopped_at)) |
209 | 217 | @orbits.resizeDomain started_at, stopped_at | ... | ... |