Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

made seperate files for anim.widget and animation.rangeselect

Benjaminc7eb1fe5d3b0
diff --git a/web/js/date/wv.date.anim.ui.js b/web/js/date/wv.date.anim.rangeselect.js
similarity index 66%
rename from web/js/date/wv.date.anim.ui.js
rename to web/js/date/wv.date.anim.rangeselect.js
index a74890f08..bd3d60483 100644
--- a/web/js/date/wv.date.anim.ui.js
+++ b/web/js/date/wv.date.anim.rangeselect.js
@@ -16,21 +16,18 @@ wv.date = wv.date || {};
wv.date.anim = wv.date.anim || {};
-wv.date.anim.ui = wv.date.anim.ui || function(models) {
+wv.date.anim.rangeselect = wv.date.anim.rangeselect || function(models, config, ui) {
var self = this;
- var widgetFactory = React.createFactory(Animate.AnimationWidget);
+ var timeline = ui.timeline;
var rangeSelectionFactory = React.createFactory(Animate.RangeSelector);
self.init = function() {
var pick = d3.select('#guitarpick');
var pickWidth = pick.node().getBoundingClientRect().width;
- var animEndLocation = (d3.transform(pick.attr("transform")).translate[0] - (pickWidth/2)); // setting guitar pick location
+ var animEndLocation = (d3.transform(pick.attr("transform")).translate[0] - (pickWidth/2)); // getting guitar pick location
var ticHeight = $('.end-tick').height();
var $animateButton = $('#animate-button');
- var Widget = widgetFactory({
- callback: self.onPressPlay,
- label: 'Frames Per Second'
- });
+
var RangeSelection = rangeSelectionFactory({
startLocation: animEndLocation - 100, // or zero
endLocation: animEndLocation,
@@ -39,20 +36,24 @@ wv.date.anim.ui = wv.date.anim.ui || function(models) {
rangeColor: '#45bdff',
rangeOpacity: 0.3,
pinWidth: 5,
- height: 45
- })
+ height: 45,
+ onDrag: self.showDateOnDrag,
+ onDragStop: self.updateRange
+ });
//mount react components
- ReactDOM.render(Widget, $('#wv-animation-widet-case')[0]);
ReactDOM.render(RangeSelection, $('#wv-rangeselector-case')[0]);
-
- self.$widgetCase = $('#wv-animation-widget');
- $animateButton.on('click', self.toggleAnimationWidget)
- };
- self.toggleAnimationWidget = function() {
- return self.$widgetCase.toggleClass('wv-active');
};
- self.onPressPlay = function(args) {
- console.log(args)
- }
+ self.showDateOnDrag = function(firstLocation, secondLocation) {
+ var date = timeline.x.invert(firstLocation);
+ timeline.pick.hoverDate(date)
+
+ }
+ self.updateRange = function(startLocation, EndLocation) {
+ var startDate = timeline.x.invert(startLocation);
+ var endDate = timeline.x.invert(EndLocation);
+ timeline.ticks.label.remove();
+ }
+
self.init();
+ return self;
}
\ No newline at end of file
diff --git a/web/js/date/wv.date.anim.widget.js b/web/js/date/wv.date.anim.widget.js
new file mode 100644
index 000000000..7aed0d398
--- /dev/null
+++ b/web/js/date/wv.date.anim.widget.js
@@ -0,0 +1,43 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 - 2016 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ *
+ * Licensed under the NASA Open Source Agreement, Version 1.3
+ * http://opensource.gsfc.nasa.gov/nosa.php
+ */
+var wv = wv || {};
+wv.date = wv.date || {};
+
+wv.date.anim = wv.date.anim || {};
+
+wv.date.anim.widget = wv.date.anim.widget || function(models, config, ui) {
+ var self = this;
+ var timeline = ui.timeline;
+ var widgetFactory = React.createFactory(Animate.AnimationWidget);
+ self.init = function() {
+ var $animateButton = $('#animate-button');
+ var Widget = widgetFactory({
+ callback: self.onPressPlay,
+ label: 'Frames Per Second'
+ });
+ //mount react component
+ ReactDOM.render(Widget, $('#wv-animation-widet-case')[0]);
+
+ self.$widgetCase = $('#wv-animation-widget');
+ $animateButton.on('click', self.toggleAnimationWidget)
+ };
+ self.toggleAnimationWidget = function() {
+ return self.$widgetCase.toggleClass('wv-active');
+ };
+ self.onPressPlay = function(args) {
+ console.log(args)
+ };
+ self.init();
+ return self;
+}
\ No newline at end of file