Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-1069 Pan timeline further than start and end dates

Taylor Gunnoe413ce51fe8b5
diff --git a/web/js/date/wv.date.timeline.config.js b/web/js/date/wv.date.timeline.config.js
index 1e0362604..051031e12 100644
--- a/web/js/date/wv.date.timeline.config.js
+++ b/web/js/date/wv.date.timeline.config.js
@@ -28,6 +28,7 @@ wv.date.timeline.config = wv.date.timeline.config || function(models, config, ui
var tickWidth;
//end tick date if tickCount is less than tickCountMax
var altEnd;
+ var paddedRange;
switch(level){
case 1:
@@ -37,10 +38,18 @@ wv.date.timeline.config = wv.date.timeline.config || function(models, config, ui
tickWidth = 15;
tickCountMax = Math.ceil(tl.width/tickWidth);
+ paddedRange = [new Date(tl.data.start()
+ .setUTCFullYear(tl.data.start().getUTCFullYear()-10)),
+ new Date(tl.data.end()
+ .setUTCFullYear(tl.data.end().getUTCFullYear()+10))];
+
altEnd = new Date(tl.data.start().getUTCFullYear() + tickCountMax,
tl.data.start().getUTCMonth(),
tl.data.start().getUTCDate());
+ tl.axisZoom
+ .xExtent(paddedRange);
+
tl.zoom.drawTicks(tickCount,
tickCountMax,
altEnd,
@@ -183,10 +192,16 @@ wv.date.timeline.config = wv.date.timeline.config || function(models, config, ui
tickWidth = 11;
tickCountMax = Math.ceil(tl.width/tickWidth);
+ paddedRange = [new Date(tl.data.start()
+ .setUTCFullYear(tl.data.start().getUTCFullYear()-1)),
+ new Date(tl.data.end()
+ .setUTCFullYear(tl.data.end().getUTCFullYear()+1))];
+
altEnd = new Date(tl.data.start().getUTCFullYear(),
tl.data.start().getUTCMonth() + tickCountMax,
tl.data.start().getUTCDate());
-
+ tl.axisZoom
+ .xExtent(paddedRange);
tl.zoom.drawTicks(tickCount,
tickCountMax,
altEnd,
@@ -313,9 +328,16 @@ wv.date.timeline.config = wv.date.timeline.config || function(models, config, ui
tickWidth = 11;
tickCountMax = Math.ceil(tl.width/tickWidth);
+ paddedRange = [new Date(tl.data.start()
+ .setUTCDate(tl.data.start().getUTCDate()-15)),
+ new Date(tl.data.end()
+ .setUTCDate(tl.data.end().getUTCDate()+15))];
+
altEnd = new Date(tl.data.start().getUTCFullYear(),
tl.data.start().getUTCMonth(),
tl.data.start().getUTCDate() + tickCountMax);
+ tl.axisZoom
+ .xExtent(paddedRange);
tl.zoom.drawTicks(tickCount,
tickCountMax,
@@ -445,13 +467,18 @@ wv.date.timeline.config = wv.date.timeline.config || function(models, config, ui
default:
console.log('Invalid Zoom level');
}
+
+
tl.ticks.check();
initTicks();
tl.pick.update();
tl.pick.checkLocation();
- };
+ tl.ticks.removePaddingData();
+
+ };
+
//Draw ticks based on zoom level
var initTicks = function(){
tl.ticks.boundary.init();
@@ -481,7 +508,7 @@ wv.date.timeline.config = wv.date.timeline.config || function(models, config, ui
});
//Default zoom
- self.zoom(2);
+ self.zoom(3);
};
init();
diff --git a/web/js/date/wv.date.timeline.data.js b/web/js/date/wv.date.timeline.data.js
index fa6e24511..332271d25 100644
--- a/web/js/date/wv.date.timeline.data.js
+++ b/web/js/date/wv.date.timeline.data.js
@@ -39,12 +39,6 @@ wv.date.timeline.data = wv.date.timeline.data || function(models, config, ui) {
.getUTCDate() + 1 ) );
};
- self.addPadding = function(){
- var buffer = tl.padding;
- self.paddedStart = tl.x.invert(-buffer);
- self.paddedEnd = tl.x.invert(tl.width + buffer);
- };
-
self.set = function(){
var activeLayers = models.layers.get();
@@ -120,8 +114,7 @@ wv.date.timeline.data = wv.date.timeline.data || function(models, config, ui) {
};
var init = function(){
- tl.axisZoom
- .xExtent( [self.start(), self.end()] );
+
};
diff --git a/web/js/date/wv.date.timeline.pan.js b/web/js/date/wv.date.timeline.pan.js
index 4cbb95e09..469328143 100644
--- a/web/js/date/wv.date.timeline.pan.js
+++ b/web/js/date/wv.date.timeline.pan.js
@@ -52,6 +52,7 @@ wv.date.timeline.pan = wv.date.timeline.pan || function(models, config, ui) {
tl.pick.checkLocation();
tl.data.set();
+ tl.ticks.removePaddingData();
};
var update = function(x, y){
diff --git a/web/js/date/wv.date.timeline.ticks.js b/web/js/date/wv.date.timeline.ticks.js
index d01835a34..39168e3f7 100644
--- a/web/js/date/wv.date.timeline.ticks.js
+++ b/web/js/date/wv.date.timeline.ticks.js
@@ -375,6 +375,20 @@ wv.date.timeline.ticks = wv.date.timeline.ticks || function(models, config, ui)
}
};
+ self.removePaddingData = function(){
+ self.all.each(function(){
+ if (((d3.select(this).data()[0] < tl.data.start()) ||
+ (d3.select(this).data()[0] > tl.data.end()))){
+ if(!d3.select(this).classed('tick-labeled')){
+ d3.select(this).remove();
+ }
+ else {
+ d3.select(this).selectAll('rect').remove();
+ }
+ }
+ });
+ };
+
self.check = function(){
var first, last, proto, end;
self.setAll();