Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Revert "Play Button"

Edmond Leee835dea9f6d1
diff --git a/doc/manual_setup.md b/doc/manual_setup.md
index 872bec0ec..2ff2c3fd1 100644
--- a/doc/manual_setup.md
+++ b/doc/manual_setup.md
@@ -56,7 +56,7 @@ grunt
The ``dist`` directory now contains ``site`` tar files that can be
can be uploaded and unpacked to a web server.
-##Building Worldview in Windows - Work in Progress
+##Building Worldview in Windows
Worldview may be built on Windows with the above instructions. First, install Node.js, Python 2, and XAMPP, then add the following to the PATH variable to include the git, nodejs, and Python binary executables (this is not an exhaustive list):
```bash
@@ -65,8 +65,6 @@ C:\Python27\;C:\Python27\Scripts\;C:\Program Files (x86)\git\bin;C:\Program File
Next install the grunt program, install the python library with "pip install xmltodict", install the packages defined in package.json with "npm install", and finally build Worldview with grunt
-NOTE: The build process in Windows may not give error but does not seem to build everything
-
##Unpacking to a XAMPP web server
Worldview can be set up on a web server powered by the cross-platform XAMPP package.
diff --git a/web/css/menuPicker.css b/web/css/menuPicker.css
index 95173c050..24d6cdcd5 100644
--- a/web/css/menuPicker.css
+++ b/web/css/menuPicker.css
@@ -1,21 +1,21 @@
-ul.menuPicker {
- margin: 0;
- padding: 0;
- color: white;
- list-style: none;
- display: block;
-}
-
-ul.menuPicker li {
- border: 1px solid black;
- background: #666;
- padding: .2em 1em;
-}
-
-ul.menuPicker li:hover {
- background: #9B1C26;
-}
-
-ul.menuPicker li.disabled {
- background: #999;
+ul.menuPicker {
+ margin: 0;
+ padding: 0;
+ color: white;
+ list-style: none;
+ display: block;
+}
+
+ul.menuPicker li {
+ border: 1px solid black;
+ background: #666;
+ padding: .2em 1em;
+}
+
+ul.menuPicker li:hover {
+ background: #9B1C26;
+}
+
+ul.menuPicker li.disabled {
+ background: #999;
}
\ No newline at end of file
diff --git a/web/css/new-ui.css b/web/css/new-ui.css
index 594bad74b..ba767dc31 100644
--- a/web/css/new-ui.css
+++ b/web/css/new-ui.css
@@ -125,7 +125,7 @@ g.plot rect.data-bar-invisible{
}
#timeline-header{
margin-top:2px;
- width:295px;
+ width:250px;
}
#timeline-header .input-wrapper{
background: transparent;
diff --git a/web/css/wv.date.css b/web/css/wv.date.css
index dca578494..6871259a3 100644
--- a/web/css/wv.date.css
+++ b/web/css/wv.date.css
@@ -9,21 +9,6 @@
* All Rights Reserved.
*/
-/* css for animation dialog*/
-.wv-header { /* header */
- margin-top: 1em;
- font-size: 14px;
- margin-bottom: 1em;
-}
-
-.wv-label-opacity { /*label*/
- text-align: right;
-}
-
-.noUi-target { /* slider */
- margin: 10px 10px 10px 15px;
-}
-
#timeds, #timemds {
position: relative;
}
diff --git a/web/index.html b/web/index.html
index d95241ed1..18563988e 100644
--- a/web/index.html
+++ b/web/index.html
@@ -220,11 +220,6 @@
<div id="imagedownload"></div>
<div id="dlMap"></div>
- <!-- ui-dialog -->
- <div id="dialog" title="Dialog Title">
-
- </div>
-
<div id="timewheels" style="display:none"></div>
<section id="timeline" style="display: none">
@@ -284,13 +279,6 @@
class="arrow"></path>
</svg>
</div>
- <div class="button-action-group" id="animate-arrow-group" title="Start animation">
- <svg width="24" height="30" >
- <path
- d="M 10.240764,0 24,15 10.240764,30 0,30 13.759236,15 0,0 10.240764,0 z"
- class="arrow"></path>
- </svg>
- </div>
</div> <!--/timeline-header-->
<div id="timeline-footer">
diff --git a/web/js/date/wv.date.anim.js b/web/js/date/wv.date.anim.js
index 509f6916b..e764b25ef 100644
--- a/web/js/date/wv.date.anim.js
+++ b/web/js/date/wv.date.anim.js
@@ -12,7 +12,6 @@
* http://opensource.gsfc.nasa.gov/nosa.php
*/
var wv = wv || {};
- var days = 0; //keep track of how many days to animate
wv.date = wv.date || {};
wv.date.anim = wv.date.anim || function(model, ui, options) {
@@ -25,6 +24,7 @@
self.interval = options.interval || "day";
self.delta = options.delta || 1;
self.active = false;
+ var expired = false;
var timer;
var init = function() {
@@ -51,62 +51,39 @@
};
self.stop = function() {
- if ( self.active ) {
- notify("stop");
- if (timer) {
- clearTimeout(timer);
- timer = null;
- }
- self.active = false;
+ notify("stop");
+ if ( timer ) {
+ clearTimeout(timer);
+ timer = null;
}
+ self.active = false;
};
var prepareFrame = function() {
- if ( !self.active )
+ if ( !self.active ) {
return;
-
+ }
notify("prepare", self);
var amount = ( self.direction === "forward" ) ?
self.delta : -self.delta;
var newDate = wv.util.dateAdd(model.selected, self.interval, amount);
ui.preload(newDate);
-
- //control animation if enabled. set before next imagery load
- if(doAnimation) days++;
-
- //if custom animation, change delay here
- self.delay = doAnimation ? animSpeed : self.delay;
-
- timer = setTimeout(function() { //this function is called once either after 500 ms or animation delay
+ timer = setTimeout(function() {
advance(newDate);
}, self.delay);
};
- var stopAnimation = function() {
- days = animDuration = 0;
- doAnimation = false;
- self.delay = 500;
- self.stop();
- };
-
var advance = function(newDate) {
notify("advance");
var updated = model.select(newDate);
-
- //determine if animation should stop
- if(doAnimation && days >= animDuration - 1 )
- stopAnimation();
-
- //determine if we can continue
- if(!updated)
- stopAnimation();
- else
- prepareFrame();
+ if ( !updated ) {
+ self.stop();
+ } else {
+ prepareFrame();
+ }
};
- //Enable console logging here if needed
- options.debug = true;
- var notify = (options.debug) ? function(message) { console.log(message); } : function() {};
+ var notify = ( options.debug ) ? console.log : function() {};
init();
return self;
diff --git a/web/js/date/wv.date.timeline.config.js b/web/js/date/wv.date.timeline.config.js
index 12eb692a3..1fb16484d 100644
--- a/web/js/date/wv.date.timeline.config.js
+++ b/web/js/date/wv.date.timeline.config.js
@@ -499,7 +499,7 @@ wv.date.timeline.config = wv.date.timeline.config || function(models, config, ui
$('#zoom-years').addClass("depth-3").css("margin","6px 0 0 0");
$('#zoom-months').addClass("depth-2");
$('#zoom-days').addClass("depth-1")
- .css("margin", "2px 0 0 0")
+ .css("margin", "8px 0 0 0")
.css('font-size','1.8em');
self.currentZoom = 3;
diff --git a/web/js/date/wv.date.timeline.input.js b/web/js/date/wv.date.timeline.input.js
index 15370c283..da5e1ae98 100644
--- a/web/js/date/wv.date.timeline.input.js
+++ b/web/js/date/wv.date.timeline.input.js
@@ -16,11 +16,6 @@ var wv = wv || {};
wv.date = wv.date || {};
wv.date.timeline = wv.date.timeline || {};
-//TODO:Remove global variables
-var doAnimation = false; //global variable to control animation
-var animDuration = 7; //control how long animation is
-var animSpeed = 500; //control how fast animation is in milliseconds
-
/**
* Implements the date input
*
@@ -37,39 +32,42 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
var $incrementBtn = $("#right-arrow-group");
var $decrementBtn = $("#left-arrow-group");
- var $animateBtn = $("#animate-arrow-group");
var forwardNextDay = function(){ //FIXME: Limit animation correctly
var nextDay = new Date(new Date(model.selected)
.setUTCDate(model.selected.getUTCDate()+1));
- if(nextDay <= wv.util.today())
+ if(nextDay <= wv.util.today()){
animateForward("day");
- else
+ }
+ else{
animateEnd();
+ }
};
var reversePrevDay = function(){ //FIXME: Limit animation correctly
- var prevDay = new Date(new Date(model.selected)
+ var prevDay = new Date(new Date(model.selected)
.setUTCDate(model.selected.getUTCDate()-1));
- if(prevDay >= tl.data.start())
+ if(prevDay >= tl.data.start() ){
animateReverse("day");
- else
+ }
+ else{
animateEnd();
+ }
};
var animateForward = function(interval) {
- if ( ui.anim.active )
+ if ( ui.anim.active ) {
return;
-
+ }
models.date.add(interval, 1);
ui.anim.interval = interval;
ui.anim.play("forward");
};
var animateReverse = function(interval) {
- if ( ui.anim.active )
+ if ( ui.anim.active ) {
return;
-
+ }
models.date.add(interval, -1);
ui.anim.interval = interval;
ui.anim.play("reverse");
@@ -110,8 +108,9 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
var kc = event.keyCode || event.which;
var entered = (kc == 13) || (kc === 9);
if ( event.type == "focusout" || entered ) {
- if ( entered )
+ if ( entered ) {
event.preventDefault();
+ }
var selected = $(this);
var YMDInterval = selected.attr('id');
@@ -167,8 +166,9 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
var sib = selected.parent().next('div.input-wrapper')
.find('input.button-input-group');
- if (entered && sib.length < 1)
+ if ( entered && sib.length < 1 ) {
$('#focus-guard-2').focus();
+ }
model.select(selectedDateObj);
@@ -176,8 +176,9 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
selected.parent().removeClass('selected');
- if (entered)
+ if ( entered ) {
sib.select().addClass('selected');
+ }
}
else{
selected.parent().css('border-color','#ff0000');
@@ -185,10 +186,13 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
selected.select();
} else {
if (document.selection)
+ {
document.selection.empty();
+ }
else
+ {
window.getSelection().removeAllRanges();
-
+ }
selected.parent().animate({
borderColor: "rgba(40, 40, 40, .9)"
}, {
@@ -220,21 +224,26 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
//Update fields
$('#year-input-group').val( model.selected.getUTCFullYear() );
$('#month-input-group').val( model.monthAbbr[ model.selected.getUTCMonth() ] );
- if ( model.selected.getUTCDate() < 10 )
+ if ( model.selected.getUTCDate() < 10 ) {
$('#day-input-group').val("0" + model.selected.getUTCDate());
- else
+ }
+ else {
$('#day-input-group').val(model.selected.getUTCDate());
+ }
//Disable arrows if nothing before/after selection
- if(nd > wv.util.today())
+ if( nd > wv.util.today() ) {
$incrementBtn.addClass('button-disabled');
- else
+ }
+ else{
$incrementBtn.removeClass('button-disabled');
-
- if(pd.toUTCString() === tl.data.start().toUTCString())
+ }
+ if( pd.toUTCString() === tl.data.start().toUTCString() ){
$decrementBtn.addClass('button-disabled');
- else
+ }
+ else{
$decrementBtn.removeClass('button-disabled');
+ }
tl.pick.update();
};
@@ -256,97 +265,8 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
})
.mouseup(animateEnd);
- $animateBtn.click(function(event) {
- $("#dialog").dialog("open");
- event.preventDefault();
- });
-
- //Add slider and html elements to dialog area
- var $header = $("<div></div>")
- .html("Days")
- .addClass("wv-header");
-
- var $speedHeader = $("<div></div>")
- .html("Speed")
- .addClass("wv-header");
-
- var $slider = $("<div></div>")
- .noUiSlider({
- start: animDuration,
- step: 1,
- range: {
- min: 1,
- max: 14
- }
- }).on("slide", function() {
- animDuration = parseFloat($slider.val());
- $label.html(animDuration);
- });
-
- var $speedSlider = $("<div></div>")
- .noUiSlider({
- start: animSpeed,
- step: 100,
- range: {
- min: 100,
- max: 1000
- }
- }).on("slide", function() {
- animSpeed = parseFloat($speedSlider.val());
- $speedLabel.html(animSpeed + ' ms');
- });
-
- var $label = $("<div></div>")
- .html(animDuration)
- .addClass("wv-label")
- .addClass("wv-label-opacity");
-
- var $speedLabel = $("<div></div>")
- .html(animSpeed + ' ms')
- .addClass("wv-label")
- .addClass("wv-label-opacity");
-
- $("#dialog").append($header).append($slider).append($label).append($speedHeader).append($speedSlider).append($speedLabel)
- .dialog({
- autoOpen: false,
- dialogClass: "wv-panel",
- title: "Play Animation",
- width: 300,
- show: { effect: "slide", direction: "down" },
- position: {
- my: "left bottom",
- at: "left top",
- of: $("#timeline-footer")
- },
- buttons: [
- {
- text: "Backward",
- click: function() {
- doAnimation = true;
- animSpeed = parseFloat($speedSlider.val());
- animDuration = parseFloat($slider.val());
- $(this).dialog("close");
- animateReverse("day");
- }
- },
- {
- text: "Forward",
- click: function() {
- doAnimation = true;
- animSpeed = parseFloat($speedSlider.val());
- animDuration = parseFloat($slider.val());
- $(this).dialog("close");
- animateForward("day");
- }
- }
- ]
- });
-
$(document)
- /*.mouseout(function() { //this is a bug! fires far too often than it should when it should only fire when mouse exits browser
- if ( ui.anim.active )
- animateEnd();
- })*/
+ .mouseout(animateEnd)
.keydown(function(event) {
switch ( event.keyCode ) {
case wv.util.key.LEFT:
@@ -357,6 +277,7 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
animateForward("day");
event.preventDefault();
break;
+
}
})
.keyup(function(event) {
@@ -457,6 +378,5 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
};
init();
-
return self;
};
diff --git a/web/js/date/wv.date.timeline.js b/web/js/date/wv.date.timeline.js
index 81865215e..c73c4917a 100644
--- a/web/js/date/wv.date.timeline.js
+++ b/web/js/date/wv.date.timeline.js
@@ -193,7 +193,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
drawContainers();
- $('#timeline-footer').css('margin-left',self.margin.left-20 + 'px'); //20 not 1 to fit animation btn
+ $('#timeline-footer').css('margin-left',self.margin.left-1 + 'px');
$('#timeline-footer').css('margin-right',self.margin.right-1 + 'px');
self.x = d3.time.scale.utc();