Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Implemented datepicker changes, some minimizing (still bugging), changed height of top and bottom of timeline, etc

Taylor Gunnoe453731c82ac2
diff --git a/src/css/new-ui.css b/src/css/new-ui.css
index 7e7aaf5e8..b1c6c52a5 100644
--- a/src/css/new-ui.css
+++ b/src/css/new-ui.css
@@ -35,7 +35,7 @@
#timeline-footer text{
font-size:14px;
font-weight:normal;
- font-family:'Play', Fallback, sans-serif;
+ font-family:‘Lucida Console’, Monaco, monospace;
font-style:normal;
font-variant:normal;
font-stretch:normal;
@@ -99,15 +99,23 @@
stroke-dashoffset:0;
}
#timeline-header{
- margin-top:7px;
+ margin-top:2px;
+}
+#timeline-header .input-wrapper{
+ background: transparent;
+ border: 1px solid transparent;
+ vertical-align:middle;
+ -moz-box-sizing:border-box;
+ box-sizing:border-box;
+ -webkit-box-sizing:border-box;
}
#timeline-header input{
- height:60px;
- background:transparent;
- border:1px solid transparent;
+ height:40px;
color:#1a1a1a;
- font-size:33px;
- font-family:'Play', Fallback, sans-serif;
+ font-size:24px;
+ background:transparent;
+ border:0px;
+ font-family:‘Lucida Console’, Monaco, monospace;
vertical-align:middle;
box-sizing:border-box;
-moz-box-sizing:border-box;
@@ -128,10 +136,13 @@
#timeline-header .focus-guard{
/* display:none;
*/}
-#timeline-header input:hover{
+#timeline-header .input-wrapper:hover{
border-color:#1a1a1a;
}
-#timeline-header .button-input-group-selected{
+#timeline-header .input-wrapper:hover .date-arrows{
+ visibility:visible;
+}
+#timeline-header .input-wrapper.selected{
border-color:#1a1a1a;
}
#timeline-header div{
@@ -140,21 +151,64 @@ display:inline-block;}
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
+ height:60px;
+ width:40px;
+ vertical-align:middle;
+ position:relative;
}
-#timeline-header svg {
- width:40px;
- height:60px;
+#timeline-header .button-action-group svg {
+ position: absolute;
+ top: 50%;
+ margin-top: -15px;
+ left: 50%;
+ margin-left: -12px;
+}
+#timeline-header .date-arrows-wrapper{
vertical-align:middle;
+ visibility:hidden;
+ display:inline-block;
+}
+#timeline-header .date-arrows{
+ display:block;
+ visibility:hidden;
+ height:10px;
+}
+#timeline-header .date-arrows svg{
+ vertical-align:top;
+ display:block;
+ margin:0 auto;
+}
+#timeline-header .date-arrows:hover svg path {
+ fill:#ffffff;
+}
+#timeline-header .date-arrow-up{
+
+}
+#timeline-header .date-arrow-down{
+ -moz-transform: scaleY(-1);
+ -o-transform: scaleY(-1);
+ -webkit-transform: scaleY(-1);
+ transform: scaleY(-1);
+ filter: FlipV;
+ -ms-filter: "FlipV";
}
-#timeline-header>div:hover {
+#timeline-header>.button-action-group:hover,#timeline-header .date-arrows:hover {
background-color:#1a1a1a;
cursor:pointer;
}
-#timeline-header>div:hover .arrow{
+#left-arrow-group{
+ -moz-transform: scaleX(-1);
+ -o-transform: scaleX(-1);
+ -webkit-transform: scaleX(-1);
+ transform: scaleX(-1);
+ filter: FlipH;
+ -ms-filter: "FlipH";
+}
+#timeline-header>.button-action-group:hover .arrow{
fill:#e2e2e2;
}
-#timeline-header svg .arrow{
+#timeline-header>.buttion-action-group:hover .arrow{
-webkit-transform: translate(8px,0px);
fill:#1a1a1a;
fill-opacity:1;
@@ -165,13 +219,16 @@ display:inline-block;}
}
#timeline-footer{
display: inline-block;
- height:75px;
+ height:65px;
margin-left:0px;
}
#timeline-footer svg {
overflow:visible;
}
+#timeline-footer svg > g{
+ overflow:hidden;
+}
/* Timeline svg classes */
@@ -198,7 +255,7 @@ display:inline-block;}
font-size:14px;
font-weight:bold;
position:absolute;
- bottom:75px;
+ bottom:65px;
left:0;
display:none;
background-color:#ff2a2a;
@@ -211,7 +268,7 @@ display:inline-block;}
display:inline-block;
vertical-align:middle;
overflow:hidden;
- height:75px;
+ height:65px;
width:100px;
box-sizing:border-box;
-moz-box-sizing:border-box;
@@ -225,7 +282,7 @@ display:inline-block;}
cursor:pointer;
text-transform:uppercase;
text-align:center;
- font-family:'Play', Fallback, sans-serif;
+ font-family:‘Lucida Console’, Monaco, monospace;
}
#timeline-zoom a.zoom-btn.depth-1{
color:#1a1a1a;
@@ -250,7 +307,7 @@ display:inline-block;}
color:#fff;
}
#timeline-hide {
- height:75px;
+ height:65px;
width:20px;
cursor:pointer;
float:right;
@@ -259,10 +316,10 @@ display:inline-block;}
#timeline-hide:hover{
background-color:#1a1a1a;
}
-.x.axis > g.tick > text.sub-label{
+.x.axis > g.tick > text > .sub-label{
fill:#777;
}
-.x.axis > g.tick:hover > text.sub-label{
+.x.axis > g.tick:hover > text > .sub-label{
fill:#fff;
}
#guitarpick{
@@ -291,7 +348,7 @@ display:inline-block;}
#timeline-hide .hamburger{
vertical-align:middle;
display:block;
- margin:32px auto 0 auto;
+ margin:26px auto 0 auto;
}
#timeline-hide .hamburger path{
fill:#1a1a1a;
diff --git a/src/index.html b/src/index.html
index ca4036723..b71e6ccae 100644
--- a/src/index.html
+++ b/src/index.html
@@ -197,6 +197,7 @@
<!-- link.dev --> <script type="text/javascript" src="js/wv.tour.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/wv.debug.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/wv.main.js"></script>
+
</head>
<body class="yui-skin-sam">
@@ -221,21 +222,57 @@
<section id="timeline">
<div id="timeline-header">
<div id="focus-guard-1" class="focus-guard" tabindex="1"></div>
- <input type="text" size="4" maxlength="4" class="button-input-group" id="year-input-group" tabindex="2" />
- <input type="text" size="2" maxlength="3" class="button-input-group" id="month-input-group" tabindex="3" />
- <input type="text" size="1" maxlength="2" class="button-input-group" id="day-input-group" tabindex="4" />
+ <div class="input-wrapper">
+ <div class="date-arrows date-arrow-up">
+ <svg width="25" height="8">
+ <path d="M 12.5,0 25,8 0,8 z" class="uparrow" />
+ </svg>
+ </div>
+ <input type="text" size="4" maxlength="4" class="button-input-group" id="year-input-group" tabindex="2" />
+ <div class="date-arrows date-arrow-down">
+ <svg width="25" height="8">
+ <path d="M 12.5,0 25,8 0,8 z" class="downarrow" />
+ </svg>
+ </div>
+ </div><!--/input-wrapper-->
+ <div class="input-wrapper">
+ <div class="date-arrows date-arrow-up">
+ <svg width="25" height="8">
+ <path d="M 12.5,0 25,8 0,8 z" class="uparrow" />
+ </svg>
+ </div>
+ <input type="text" size="3" maxlength="3" class="button-input-group" id="month-input-group" tabindex="3" />
+ <div class="date-arrows date-arrow-down">
+ <svg width="25" height="8">
+ <path d="M 12.5,0 25,8 0,8 z" class="downarrow" />
+ </svg>
+ </div>
+ </div><!--/input-wrapper-->
+ <div class="input-wrapper">
+ <div class="date-arrows date-arrow-up">
+ <svg width="25" height="8">
+ <path d="M 12.5,0 25,8 0,8 z" class="uparrow" />
+ </svg>
+ </div>
+ <input type="text" size="2" maxlength="2" class="button-input-group" id="day-input-group" tabindex="4" />
+ <div class="date-arrows date-arrow-down">
+ <svg width="25" height="8">
+ <path d="M 12.5,0 25,8 0,8 z" class="downarrow" />
+ </svg>
+ </div>
+ </div><!--/input-wrapper-->
<div id="focus-guard-2" class="focus-guard" tabindex="5"></div>
<div class="button-action-group" id="left-arrow-group">
- <svg>
+ <svg width="24" height="30">
<path
- d="M 13.759236,15 0,30 13.759236,45 24,45 10.240764,30 24,15 13.759236,15 z"
+ d="M 10.240764,0 24,15 10.240764,30 0,30 13.759236,15 0,0 10.240764,0 z"
class="arrow" />
</svg>
</div>
<div class="button-action-group" id="right-arrow-group">
- <svg >
+ <svg width="24" height="30" >
<path
- d="M 10.240764,15 24,30 10.240764,45 0,45 13.759236,30 0,15 10.240764,15 z"
+ d="M 10.240764,0 24,15 10.240764,30 0,30 13.759236,15 0,0 10.240764,0 z"
class="arrow" />
</svg>
</div>
diff --git a/src/js/date/wv.date.timeline.js b/src/js/date/wv.date.timeline.js
index 06f900105..a80a1684c 100644
--- a/src/js/date/wv.date.timeline.js
+++ b/src/js/date/wv.date.timeline.js
@@ -38,10 +38,11 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
var subInterval = d3.time.day.utc;
var subStep = 1;
var zoomScale,axisBgWidth,subAxisBgWidth,smallTicks,guitarPick,chartBody,layers;
+ var timer,selectedDate, daysInMonth;
var margin = {
top: 0,
right: 0,
- bottom: 35,
+ bottom: 20,
left: 10
};
@@ -49,10 +50,17 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
var width;
var setWidth = function(){width = window.innerWidth - $("#timeline-header").outerWidth() - $("#timeline-zoom").outerWidth() - $("#timeline-hide").outerWidth() - 40;};
setWidth();
- var height = 75 - margin.top - margin.bottom;
+ var height = 65 - margin.top - margin.bottom;
var monthNames = [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ];
+ var monthNumber = function(name){
+ for (var i=0;i<monthNames.length;i++){
+ if (name.toUpperCase() === monthNames[i]){
+ return i;
+ }
+ }
+ };
var self = {};
self.NAME = "TEST NAME";
// TODO: Prefix names with $ to indicate they are jQuery objects
@@ -143,7 +151,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
//UPDATE GUITARPICK
if (guitarPick){
- guitarPick.attr("transform","translate("+(x(model.selected)-25)+",-20)");
+ guitarPick.attr("transform","translate("+(x(model.selected)-25)+",-16)");
}
};
@@ -176,9 +184,8 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
//draw sub-label (high freq)
if(subLabel){
- tickGroup.append("svg:text")
- .text(subLabel)
- .attr("y","30")
+ tickGroup.select('text').append("tspan")
+ .text(" " + subLabel)
.attr("class","sub-label");
}
var x2 = d3.time.scale.utc()
@@ -240,20 +247,25 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
var tickParent = d3.select(this.parentNode.parentNode);
var tickDate = d;
var rectWidth = tickParent.select('rect.axis-background').attr("width");
-
+ if (zoomLvl === 0){
+ tickDate = new Date(d.getUTCFullYear(),model.selected.getUTCMonth(),model.selected.getUTCDate());
+ }
+ else if (zoomLvl === 1){
+ tickDate = new Date(d.getUTCFullYear(),d.getUTCMonth(),model.selected.getUTCDate());
+ }
tickParent.selectAll('.tick-label, .sub-label').attr("visibility","hidden");
tickParent.append("svg:text")
.attr("class","hover-tick-label")
.attr("y","15")
.attr("x",rectWidth/2)
.attr("style","text-anchor:middle")
- .text(tickDate.getUTCDate() + " " + monthNames[tickDate.getUTCMonth()]);
- tickParent.append("svg:text")
+ .text(tickDate.getUTCDate() + " " + monthNames[tickDate.getUTCMonth()] + " " + tickDate.getUTCFullYear());
+/* tickParent.append("svg:text")
.attr("class","hover-sub-label")
.attr("y","30")
.attr("x",rectWidth/2)
.attr("style","text-anchor:middle")
- .text(tickDate.getUTCFullYear());
+ .text(tickDate.getUTCFullYear());*/
})
.on("mouseleave",function(d){
@@ -295,7 +307,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
$('#day-input-group').val(model.selected.getUTCDate());
}
- guitarPick.attr("transform","translate("+(x(model.selected)-25)+",-20)");
+ guitarPick.attr("transform","translate("+(x(model.selected)-25)+",-16)");
// Don't grab focus to allow arrow keys to work
//$('.button-input-group-selected').select();
@@ -308,6 +320,8 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
setWidth();
d3.select('#timeline-footer svg')
.attr('width', width + margin.left + margin.right);
+ d3.select('#timeline-boundary rect').attr('width',width+margin.left+margin.right);
+ d3.select('#guitarpick-boundary rect').attr('width',width+margin.left+margin.right);
timeline.select(".x.axis line:first-child").attr("x2",width);
//redrawAxis();
};
@@ -380,8 +394,8 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
.attr("id","guitarpick-boundary")
.append("svg:rect")
.attr('width', width + margin.left + margin.right)
- .attr('height', height + margin.top + margin.bottom+10)
- .attr("y","-20");
+ .attr('height', height + margin.top + margin.bottom)
+ .attr("y","-16");
timeline = d3.select("#timeline-footer svg")
.append("svg:g")
@@ -392,6 +406,8 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
timeline.append("svg:g")
.attr("class", "x axis")
+// .attr("clip-path","#timeline-boundary")
+// .style("clip-path","url(#timeline-boundary)")
.attr("transform", "translate(0," + height + ")")
.insert("line",":first-child")
.attr("x1",-10)
@@ -431,7 +447,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
.attr("id","guitarpick")
.attr("style","clip-path:url(#guitarpick-boundary);")
.append("svg:g")
- .attr("transform","translate("+(x(model.selected)-28)+",-20)");
+ .attr("transform","translate("+(x(model.selected)-28)+",-16)");
guitarPick.append("svg:path")
.attr("d", "M 7.3151,0.7426 C 3.5507,0.7426 0.5,3.7926 0.5,7.5553 l 0,21.2724 14.6038,15.7112 14.6039,15.7111 14.6038,-15.7111 14.6037,-15.7112 0,-21.2724 c 0,-3.7627 -3.051,-6.8127 -6.8151,-6.8127 l -44.785,0 z");
@@ -452,13 +468,9 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
.attr("y","11");
var mousedown = false;
guitarPick.on("mousedown",function(){ //TODO: Drag slider over small axes
- console.log("mousedown");
mousedown = true;
d3.event.preventDefault();
d3.event.stopPropagation();
-// console.log(d3.mouse(this)[0]);
-
-
})
.on("mouseup",function(){
mousedown = false;
@@ -485,7 +497,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
break;
}
- guitarPick.attr("transform","translate("+ (x(newDate)-28) +",-20)");
+ guitarPick.attr("transform","translate("+ (x(newDate)-28) +",-16)");
model.select(newDate);
}
});
@@ -496,23 +508,144 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
});
//bind click action to interval radio buttons
- var buttons = $('.button-input-group');
- buttons.on('focus',function(e){
- buttons.removeClass('button-input-group-selected');
- $(this).addClass('button-input-group-selected');
+ var $buttons = $('.button-input-group');
+ $buttons.on('focus',function(e){
+ e.preventDefault();
+ $buttons.siblings('.date-arrows').css('visibility','');
+ $buttons.parent().removeClass('selected');
+ $(this).parent().addClass('selected');
+ $(this).siblings('.date-arrows').css('visibility','visible');
+ });
+ $buttons.click(function(e){
+ $(this).select();
+ });
+ $buttons.focusout(function(e){
+ $buttons.siblings('.date-arrows').css('visibility','');
+ $buttons.parent().removeClass('selected');
+ });
+ var $incrementIntDate = $('.date-arrow-up');
+ var $decrementIntDate = $('.date-arrow-down');
+ $incrementIntDate.click(function(e){
+ if(timer){
+ clearTimeout(timer);
+ daysInMonth = (new Date(selectedDate.getUTCFullYear(),selectedDate.getUTCMonth()+1,0)).getUTCDate();
+ }
+ else{
+ selectedDate = new Date(model.selected);
+ daysInMonth = (new Date(model.selected.getUTCFullYear(),model.selected.getUTCMonth()+1,0)).getUTCDate();
+ }
+ var $interval = $(this).siblings('.button-input-group').attr('id').replace("-input-group", "");
+ var $dateVal = $(this).siblings('input.button-input-group');
+
+ switch($interval){
+ case 'day':
+ var numberDate;
+ if(parseInt($dateVal.val())<daysInMonth){
+ numberDate = parseInt(selectedDate.getUTCDate())+1;
+ }
+ else{
+ numberDate = 1;
+ }
+ if (numberDate>9){
+ $dateVal.val(numberDate);
+ }
+ else{
+ $dateVal.val("0" + numberDate);
+ }
+ selectedDate.setUTCDate(numberDate);
+ break;
+ case 'month':
+ var monthDate;
+ if (monthNumber($dateVal.val())+1<monthNames.length){
+ monthDate = parseInt(selectedDate.getUTCMonth())+1;
+ }
+ else{
+ monthDate = 0;
+ }
+ $dateVal.val(monthNames[monthDate]);
+ selectedDate.setUTCMonth(monthDate);
+ break;
+ case 'year':
+ $dateVal.val(parseInt(selectedDate.getUTCFullYear())+1);
+ selectedDate.setUTCFullYear($dateVal.val());
+ break;
+ }
+ timer = setTimeout(function(){
+ model.select(selectedDate);
+ timer = null;
+ },1000);
+ $(this).siblings('.button-input-group').focus();
+ });
+ $('input').focus(function(e){
$(this).select();
});
+
+ $decrementIntDate.click(function(e){
+ if(timer){
+ clearTimeout(timer);
+ daysInMonth = (new Date(selectedDate.getUTCFullYear(),selectedDate.getUTCMonth()+1,0)).getUTCDate();
+ }
+ else{
+ selectedDate = new Date(model.selected);
+ daysInMonth = (new Date(model.selected.getUTCFullYear(),model.selected.getUTCMonth()+1,0)).getUTCDate();
+ }
+ var $interval = $(this).siblings('.button-input-group').attr('id').replace("-input-group", "");
+ var $dateVal = $(this).siblings('input.button-input-group');
+
+ switch($interval){
+ case 'day':
+ var numberDate;
+ if($dateVal.val()>1){
+ numberDate = parseInt(selectedDate.getUTCDate())-1;
+ }
+ else{
+ numberDate = daysInMonth;
+ }
+ if(numberDate>9){
+ $dateVal.val(numberDate);
+ }
+ else{
+ $dateVal.val("0" + numberDate);
+ }
+ selectedDate.setUTCDate(numberDate);
+ break;
+ case 'month':
+ var monthDate;
+ if (monthNumber($dateVal.val())>0){
+ monthDate = parseInt(selectedDate.getUTCMonth())-1;
+ }
+ else{
+ monthDate = 11;
+ }
+ $dateVal.val(monthNames[monthDate]);
+ selectedDate.setUTCMonth(monthDate);
+ break;
+ case 'year':
+ $dateVal.val(parseInt(selectedDate.getUTCFullYear())-1);
+ selectedDate.setUTCFullYear($dateVal.val());
+ break;
+ }
+ timer = setTimeout(function(){
+ model.select(selectedDate);
+ timer = null;
+ },1000);
+
+ $(this).siblings('.button-input-group').focus();
+ });
$('#timeline-hide').click(function(e){
- var $tl = $('#timeline-footer, #timeline-zoom');
- if($tl.is(':hidden')){
- $tl.show('slow');
+ var tl = d3.select('#timeline-footer svg');
+ var tlZ = d3.select('#timeline-zoom');
+ if(tl.style('display')==='none'){
+ tl.style('display','');
+ tlZ.style('display','');
+
$('#timeline').css('right','10px');
- d3.select('#timeline-footer svg g').attr("clip-path","#timeline-boundary");
- $("#guitarpick").show();
+ d3.select("#guitarpick").attr("style","display:block;");
}
else{
- $tl.hide('slow');
- $("#guitarpick").hide();
+ tl.style('display','none');
+ tlZ.style('display','none');
+ d3.select("#guitarpick").attr("style","display:none;");
$('#timeline').css('right','auto');
}
@@ -535,11 +668,10 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
});
updateTime();
- $('#day-input-group').addClass('button-input-group-selected');
- $('#day-input-group').select();
+
$('.button-input-group').change(function(){
- if($(this).hasClass('button-input-group-selected')){
- var selected = $(".button-input-group-selected");
+ if($(this).parent().hasClass('selected')){
+ var selected = $(this);
var YMDInterval = selected.attr('id');
var newInput = selected.val();
switch(YMDInterval){
@@ -561,6 +693,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
selectedDateObj = new Date((new Date(model.selected)).setUTCDate(newInput));
try {
model.select(selectedDateObj);
+ $(this).select();
}
catch(e){
//TODO: error catching
@@ -757,7 +890,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
var animateEnd = function() {
ui.anim.stop();
};
-
+ var zoomLvlTiny = 0;
var zoomable = function(e){
var mousePos = x.invert(d3.mouse(this)[0]);
@@ -768,15 +901,23 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {
if (deltaY < 0){
//console.log("Up");
if (zoomLvl < 3){
- zoomLvl++;
- setZoomLevel(zoomLvl,mousePos,mouseOffset);
+ zoomLvlTiny++;
+ if (zoomLvlTiny===3){
+ zoomLvl++;
+ zoomLvlTiny = 0;
+ setZoomLevel(zoomLvl,mousePos,mouseOffset);
+ }
}
}
else if (deltaY > 0){
//console.log("Down")
if (zoomLvl > 0){
- zoomLvl--;
- setZoomLevel(zoomLvl,mousePos,mouseOffset);
+ zoomLvlTiny--;
+ if (zoomLvlTiny===-3){
+ zoomLvl--;
+ zoomLvlTiny = 0;
+ setZoomLevel(zoomLvl,mousePos,mouseOffset);
+ }
}
}
else{