Interactive interface for browsing global, full-resolution satellite imagery
WV-885: Arrow keys for +/- days
Mike McGann2aa529b71f3d
diff --git a/src/js/date/wv.date.anim.js b/src/js/date/wv.date.anim.jsindex b409c715e..825674bf4 100644--- a/src/js/date/wv.date.anim.js+++ b/src/js/date/wv.date.anim.js@@ -38,7 +38,7 @@} else if ( self.active ) {return;}- console.log("play");+ notify("play");self.direction = direction || self.direction;self.active = true;prepareFrame();@@ -53,7 +53,7 @@};self.stop = function() {- //console.log("stop");+ notify("stop");if ( timer ) {clearTimeout(timer);timer = null;@@ -65,19 +65,19 @@if ( !self.active ) {return;}- //console.log("prepare", self);+ notify("prepare", self);loaded = false;expired = false;var amount = ( self.direction === "forward" ) ?self.delta : -self.delta;var newDate = wv.util.dateAdd(model.selected, self.interval, amount);ui.preload(newDate, function() {- //console.log("loaded");+ notify("loaded");loaded = true;checkFrame(newDate);});timer = setTimeout(function() {- //console.log("expired");+ notify("expired");expired = true;checkFrame(newDate);}, self.delay);@@ -85,7 +85,7 @@var checkFrame = function(newDate) {if ( loaded && expired ) {- //console.log("advance");+ notify("advance");var updated = model.select(newDate);if ( !updated ) {self.stop();@@ -94,7 +94,9 @@}}};-++ var notify = ( options.debug ) ? console.log : function() {};+init();return self;};diff --git a/src/js/date/wv.date.timeline.js b/src/js/date/wv.date.timeline.jsindex 82ad85a93..09c42cad4 100644--- a/src/js/date/wv.date.timeline.js+++ b/src/js/date/wv.date.timeline.js@@ -234,7 +234,35 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {decrementBtn.mousedown(animateReverse).mouseup(animateEnd);-+ $(document)+ .keydown(function(event) {+ if ( event.target.nodeName === "INPUT" ) {+ return;+ }+ switch ( event.keyCode ) {+ case wv.util.key.LEFT:+ animateReverse();+ event.preventDefault();+ break;+ case wv.util.key.RIGHT:+ animateForward();+ event.preventDefault();+ break;+ }+ })+ .keyup(function(event) {+ if ( event.target.nodeName === "INPUT" ) {+ return;+ }+ switch ( event.keyCode ) {+ case wv.util.key.LEFT:+ case wv.util.key.RIGHT:+ animateEnd();+ event.preventDefault();+ break;+ }+ });+svg = d3.select('#timeline footer').append("svg:svg").attr('width', width + margin.left + margin.right)@@ -334,7 +362,7 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {//bind click action to interval radio buttonsvar buttons = $('.button-input-group');buttons.on('focus',function(e){- // e.stopPropagation();+ //e.stopPropagation();// e.preventDefault();buttons.removeClass('button-input-group-selected');$(this).addClass('button-input-group-selected');@@ -413,6 +441,8 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {}});+ $("#day-input-group").blur();+}; // /initvar bindTimelineMouseMove = function() {var mouse_x = d3.mouse(this)[0];@@ -483,7 +513,9 @@ wv.date.timeline = wv.date.timeline || function(models, config, ui) {}//remove selection when clicking too fast//document.getSelection().removeAllRanges();- $('.button-input-group-selected').select();++ // Don't grab focus to allow arrow keys to work+ //$('.button-input-group-selected').select();data2[0].date = model.selected.getTime();data2[1].date = data2[0].date;updateTimeline();diff --git a/src/js/wv.debug.js b/src/js/wv.debug.jsindex d1a1f0162..554a6ba4a 100644--- a/src/js/wv.debug.js+++ b/src/js/wv.debug.js@@ -85,6 +85,13 @@ wv.debug.layers = wv.debug.layers || function(ui, models, config) {var type;var selectedLayer;+ var useDebugPanel = {+ "gibs": true,+ "layers": true,+ "palettes": true,+ "dataDownload": true+ };+var init = function() {type = config.parameters.debug;if ( config.parameters.debugGIBS ) {@@ -94,7 +101,7 @@ wv.debug.layers = wv.debug.layers || function(ui, models, config) {ui.sidebar.collapse();//ui.dateSliders.collapse();}- if ( type ) {+ if ( useDebugPanel[type] ) {if ( type === "palettes" ) {wv.palettes.loadCustom(config).done(render);} else {@@ -163,8 +170,6 @@ wv.debug.layers = wv.debug.layers || function(ui, models, config) {$select.empty();var proj = models.proj.selected.id;var sortedLayers = _.sortBy(config.layers, ["title", "subtitle"]);- console.log(config.layers);- console.log(sortedLayers);_.each(sortedLayers, function(layer) {if ( acceptLayer(layer) ) {var names = models.layers.getTitles(layer.id);diff --git a/src/js/wv.main.js b/src/js/wv.main.jsindex 5c5ce91e8..242b3db5e 100644--- a/src/js/wv.main.js+++ b/src/js/wv.main.js@@ -141,7 +141,9 @@ $(function() {var ui = {};ui.map = wv.map.ui(models, config);- ui.anim = wv.date.anim(models.date, ui.map);+ ui.anim = wv.date.anim(models.date, ui.map, {+ debug: parameters.debug === "anim"+ });ui.proj = wv.proj.ui(models, config);ui.sidebar = wv.layers.sidebar(models, config);ui.activeLayers = wv.layers.active(models, ui, config);@@ -201,6 +203,13 @@ $(function() {}*/+ // Sink all focus on inputs if click unhandled+ $(document).click(function(event) {+ if ( event.target.nodeName !== "INPUT" ) {+ $("input").blur();+ }+ });+// Console notificationsif ( wv.brand.release() ) {console.info(wv.brand.NAME + " - Version " + wv.brand.VERSION +