Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fixed button and text placement, remove mouseoff listener because it is a bug, and added forward animation for the animation UI prototype

Edmond Lee6fea21ba216b
diff --git a/web/css/new-ui.css b/web/css/new-ui.css
index ba767dc31..594bad74b 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:250px;
+ width:295px;
}
#timeline-header .input-wrapper{
background: transparent;
diff --git a/web/js/date/wv.date.anim.js b/web/js/date/wv.date.anim.js
index 92ed47e16..3cd1717ad 100644
--- a/web/js/date/wv.date.anim.js
+++ b/web/js/date/wv.date.anim.js
@@ -52,12 +52,14 @@
};
self.stop = function() {
- notify("stop");
- if ( timer ) {
- clearTimeout(timer);
- timer = null;
+ if ( self.active ) {
+ notify("stop");
+ if (timer) {
+ clearTimeout(timer);
+ timer = null;
+ }
+ self.active = false;
}
- self.active = false;
};
var prepareFrame = function() {
@@ -81,27 +83,28 @@
}, 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 ) {
- days = animDuration = 0;
- doAnimation = false;
- self.delay = 500;
- self.stop();
- }
+ if(doAnimation && days >= animDuration - 1 )
+ stopAnimation();
- if (!updated)
- self.stop();
- else
- prepareFrame();
+ //determine if we can continue
+ !updated ? stopAnimation() : prepareFrame();
};
//Enable console logging here if needed
- options.debug = false;
- var notify = ( options.debug ) ? function(message) { console.log(message); } : function() {};
+ options.debug = true;
+ var notify = (options.debug) ? function(message) { console.log(message); } : 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 1fb16484d..12eb692a3 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", "8px 0 0 0")
+ .css("margin", "2px 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 9484a8f31..15370c283 100644
--- a/web/js/date/wv.date.timeline.input.js
+++ b/web/js/date/wv.date.timeline.input.js
@@ -16,6 +16,7 @@ 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
@@ -109,9 +110,8 @@ 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,9 +167,8 @@ 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);
@@ -177,9 +176,8 @@ 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');
@@ -187,13 +185,10 @@ 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)"
}, {
@@ -225,26 +220,21 @@ 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();
};
@@ -289,8 +279,8 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
max: 14
}
}).on("slide", function() {
- animDuration = $slider.val();
- $label.html(parseFloat(animDuration));
+ animDuration = parseFloat($slider.val());
+ $label.html(animDuration);
});
var $speedSlider = $("<div></div>")
@@ -302,8 +292,8 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
max: 1000
}
}).on("slide", function() {
- animSpeed = $speedSlider.val();
- $speedLabel.html(parseFloat(animSpeed) + ' ms');
+ animSpeed = parseFloat($speedSlider.val());
+ $speedLabel.html(animSpeed + ' ms');
});
var $label = $("<div></div>")
@@ -330,20 +320,33 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
},
buttons: [
{
- text: "Animate",
+ text: "Backward",
click: function() {
doAnimation = true;
animSpeed = parseFloat($speedSlider.val());
animDuration = parseFloat($slider.val());
- $( this ).dialog( "close" );
+ $(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() {console.log("stopping in document mouseout()"); animateEnd();})
+ /*.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();
+ })*/
.keydown(function(event) {
switch ( event.keyCode ) {
case wv.util.key.LEFT:
diff --git a/web/js/date/wv.date.timeline.js b/web/js/date/wv.date.timeline.js
index c73c4917a..81865215e 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-1 + 'px');
+ $('#timeline-footer').css('margin-left',self.margin.left-20 + 'px'); //20 not 1 to fit animation btn
$('#timeline-footer').css('margin-right',self.margin.right-1 + 'px');
self.x = d3.time.scale.utc();