Interactive interface for browsing global, full-resolution satellite imagery
refine zoom level changes. update subdaily throughout timeline, input, and animation
Edward Plato6572abd2d1a2
diff --git a/web/js/animation/widget.js b/web/js/animation/widget.jsindex 83a4cfd8f..1f1490fab 100644--- a/web/js/animation/widget.js+++ b/web/js/animation/widget.js@@ -45,7 +45,7 @@ export function animationWidget(models, config, ui) {endDate: new Date(model.rangeState.endDate),minDate: models.date.minDate(),maxDate: models.date.maxDate(),- maxZoom: models.date.maxZoom,+ hasSubdailyLayers: models.layers.hasSubDaily(),onClose: self.toggleAnimationWidget};@@ -152,7 +152,8 @@ export function animationWidget(models, config, ui) {self.reactComponent.setState({startDate: new Date(state.startDate),endDate: new Date(state.endDate),- maxZoom: models.date.maxZoom,+ // maxZoom: models.date.maxZoom,+ hasSubdailyLayers: models.layers.hasSubDaily(),playing: state.playing,increment: self.getIncrements(), // config.currentZoom is a number: 1,2,3incrementArray: lodashWithout(zooms, self.getIncrements()) // array of zooms without current zoom@@ -169,7 +170,8 @@ export function animationWidget(models, config, ui) {**/self.getIncrements = function() {- if (models.date.maxZoom > 3) {+ // if (models.date.maxZoom > 3) {+ if (models.layers.hasSubDaily()) {zooms = ['yearly', 'monthly', 'daily', '10-Minute'];} else {zooms = ['yearly', 'monthly', 'daily'];diff --git a/web/js/components/animation-widget/animation-widget.js b/web/js/components/animation-widget/animation-widget.jsindex d06c755f9..d07f1e914 100644--- a/web/js/components/animation-widget/animation-widget.js+++ b/web/js/components/animation-widget/animation-widget.js@@ -44,7 +44,7 @@ class AnimationWidget extends React.Component {looping: props.looping,startDate: props.startDate,endDate: props.endDate,- maxZoom: props.maxZoom,+ hasSubdailyLayers: props.hasSubdailyLayers,header: props.header,incrementArray: props.incrementArray,increment: props.increment@@ -134,7 +134,7 @@ class AnimationWidget extends React.Component {<divid="wv-animation-widget"className={- 'wv-animation-widget' + (this.state.maxZoom >= 4 ? ' subdaily' : '')+ 'wv-animation-widget' + (this.state.hasSubdailyLayers ? ' subdaily' : '')}><AnimWidgetHeader@@ -186,7 +186,7 @@ class AnimationWidget extends React.Component {onDateChange={this.onDateChange.bind(this)}maxDate={this.state.endDate}minDate={this.props.minDate}- maxZoom={this.state.maxZoom}+ hasSubdailyLayers={this.state.hasSubdailyLayers}/><div className="thru-label">To</div><TimeSelector@@ -198,7 +198,7 @@ class AnimationWidget extends React.Component {onDateChange={this.onDateChange.bind(this)}maxDate={this.props.maxDate}minDate={this.state.startDate}- maxZoom={this.state.maxZoom}+ hasSubdailyLayers={this.state.hasSubdailyLayers}/></div><i className="fa fa-times wv-close" onClick={this.props.onClose} />@@ -228,7 +228,7 @@ AnimationWidget.propTypes = {onPushGIF: PropTypes.func,minDate: PropTypes.object,maxDate: PropTypes.object,- maxZoom: PropTypes.number,+ hasSubdailyLayers: PropTypes.bool,onClose: PropTypes.func};diff --git a/web/js/components/date-selector/date-selector.js b/web/js/components/date-selector/date-selector.jsindex c6e0133bf..2e3a17d2c 100644--- a/web/js/components/date-selector/date-selector.js+++ b/web/js/components/date-selector/date-selector.js@@ -21,7 +21,8 @@ class DateSelector extends React.Component {maxDate: props.maxDate,minDate: props.minDate,tab: null,- maxZoom: props.maxZoom+ // maxZoom: props.maxZoom,+ hasSubdailyLayers: props.hasSubdailyLayers};}componentWillReceiveProps(props) {@@ -29,7 +30,8 @@ class DateSelector extends React.Component {date: props.date,maxDate: props.maxDate,minDate: props.minDate,- maxZoom: props.maxZoom+ // maxZoom: props.maxZoom,+ hasSubdailyLayers: props.hasSubdailyLayers});}// shouldComponentUpdate(prevProps, prevState) {@@ -48,7 +50,8 @@ class DateSelector extends React.Component {changeTab(index) {var nextTab = index;var maxTab;- if (this.state.maxZoom >= 4) {+ // if (this.state.maxZoom >= 4) {+ if (this.state.hasSubdailyLayers) {maxTab = 5;} else {maxTab = 3;@@ -78,7 +81,7 @@ class DateSelector extends React.Component {this.props.onDateChange(date, true);}renderSubdaily() {- if (this.state.maxZoom >= 4) {+ if (this.props.hasSubdailyLayers) {return (<React.Fragment><DateInputColumn@@ -128,6 +131,7 @@ class DateSelector extends React.Component {}}render() {+ console.log(this.props.date)return (<div className="wv-date-selector-widget"><DateInputColumn@@ -208,7 +212,8 @@ DateSelector.propTypes = {height: PropTypes.string,width: PropTypes.string,idSuffix: PropTypes.string,- fontSize: PropTypes.number+ fontSize: PropTypes.number,+ hasSubdailyLayers: PropTypes.bool};export default DateSelector;diff --git a/web/js/components/date-selector/input.js b/web/js/components/date-selector/input.jsindex 336b5a2b5..6c288c3c4 100644--- a/web/js/components/date-selector/input.js+++ b/web/js/components/date-selector/input.js@@ -197,12 +197,15 @@ class DateInputColumn extends React.Component {minuteValidation(input) {var newDate;- var coeff = 1000 * 60 * 10;+ // var coeff = 1000 * 60 * 10;+ console.log(input);if (input >= 0 && input <= 59) {- newDate = new Date(- Math.round(new Date(this.props.date).setUTCMinutes(input) / coeff) *- coeff- );+ // newDate = new Date(+ // Math.round(new Date(this.props.date).setUTCMinutes(input) / coeff) *+ // coeff+ // );+ newDate = new Date(new Date(this.props.date).setUTCMinutes(input));+ console.log(newDate)return this.validateDate(newDate);}}diff --git a/web/js/components/timeline/interval-selector/interval-selector.js b/web/js/components/timeline/interval-selector/interval-selector.jsindex 9df3e7e3f..ca2fd52f9 100644--- a/web/js/components/timeline/interval-selector/interval-selector.js+++ b/web/js/components/timeline/interval-selector/interval-selector.js@@ -39,6 +39,10 @@ class CustomIntervalSelectorWidget extends React.Component {})}+ setIntervalChangeUnit = () => {+ this.props.setIntervalChangeUnit(this.state.intervalValue, this.state.zoomLevel);+ }+componentDidMount() {this.setState({intervalValue: this.props.customIntervalValue,@@ -72,7 +76,8 @@ class CustomIntervalSelectorWidget extends React.Component {<div style={{display: 'flex', flexDirection: 'column' }} className="custom-interval-buttons"><Button- onClick={() => this.props.setInterval(this.state.intervalValue, this.state.zoomLevel)}+ // onClick={() => this.props.setInterval(this.state.intervalValue, this.state.zoomLevel)}+ onClick={this.setIntervalChangeUnit}id='set-interval-button'text='Set'className='red'diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.jsindex dbbdb37f4..3dc5bf665 100644--- a/web/js/components/timeline/timeline-axis/timeline-axis.js+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js@@ -600,7 +600,7 @@ class TimelineAxis extends React.Component {handleResize = (e) => {// let axisWidth = Math.floor(window.innerWidth * 0.9);- let axisWidth = this.props.width;+ let axisWidth = this.props.timelineWidth;let timeScale = this.state.timeScale;this.updateScale(null, timeScale, axisWidth);// console.log('resize')@@ -619,7 +619,7 @@ class TimelineAxis extends React.Component {//# resizewindow.addEventListener("resize", this.handleResize);// let axisWidth = Number((window.innerWidth * 0.9).toFixed(2));- let axisWidth = this.props.width;+ let axisWidth = this.props.timelineWidth;let timeScale = this.props.timeScale; // 'day'let time = moment.utc(this.props.selectedDate).format() //'1941-01-01T12:00:00Z';@@ -736,6 +736,7 @@ class TimelineAxis extends React.Component {//# BEST WAY TO HANDLE THIS?componentDidUpdate(prevProps, prevState) {// console.log(this.props)+// console.log(prevProps.selectedDate, this.props.selectedDate, this.state.selectedDate, prevState.selectedDate)if (this.props.inputChange === true) {console.log(this.props.selectedDate)@@ -753,37 +754,37 @@ class TimelineAxis extends React.Component {this.updateScale(null, this.state.timeScale);}- if (prevProps.timeScaleChangeUnit !== this.props.timeScaleChangeUnit) {- this.updateScale(null, this.props.timeScaleChangeUnit);- }+ // if (prevProps.timeScaleChangeUnit !== this.props.timeScaleChangeUnit) {+ // this.updateScale(null, this.props.timeScaleChangeUnit);+ // }- if (this.props.width !== prevProps.width) {+ if (this.props.timelineWidth !== prevProps.timelineWidth) {this.handleResize();}// console.log(prevProps.selectedDate, this.props.selectedDate, this.state.selectedDate, prevState.selectedDate)// console.log(prevProps.draggerTimeState, this.props.draggerTimeState, this.state.draggerTimeState, prevState.draggerTimeState)-- if (this.props.selectedDate !== prevProps.selectedDate &&- this.state.draggerTimeState !== prevState.draggerTimeState &&+// # CHANGED CONDITIONAL FROM "&&" TO "||" TO DEBUG LEFT/RIGHT ARROW UPDATE ISSUE+ if (this.props.selectedDate !== prevProps.selectedDate ||+ this.state.draggerTimeState !== prevState.draggerTimeState ||moment.utc(this.state.draggerTimeState).format() !== moment.utc(prevState.draggerTimeState).format()) {// moment.utc(this.state.draggerTimeState).format() !== moment.utc(prevState.draggerTimeState).format()) {s- // if (this.props.selectedDate !== prevProps.selectedDate &&+ // if (this.props.selectedDate !== prevProps.selectedDate &&// moment.utc(this.state.hoverTime).format() !== moment.utc(this.props.selectedDate).format()// && moment.utc(this.state.draggerTimeState).format() !== moment.utc(this.props.selectedDate).format()) {// console.log(this.props.selectedDate, prevProps.selectedDate, this.state.hoverTime, this.state.draggerTimeState)// console.log(moment.utc(this.state.hoverTime).format(), moment.utc(this.props.selectedDate).format())- let manualTimeScaleChangeUnit = this.props.timeScaleChangeUnit || this.state.timeScale;+ // let manualTimeScaleChangeUnit = this.props.timeScaleChangeUnit || this.state.timeScale;- let options = timeScaleOptions[manualTimeScaleChangeUnit].timeAxis;- let gridWidth = options.gridWidth;+ // let options = timeScaleOptions[manualTimeScaleChangeUnit].timeAxis;+ // let gridWidth = options.gridWidth;- let frontDate = moment.utc(this.state.deque.peekFront().rawDate);- let newSelectedDate = moment.utc(this.props.selectedDate);+ // let frontDate = moment.utc(this.state.deque.peekFront().rawDate);+ // let newSelectedDate = moment.utc(this.props.selectedDate);// console.log(newSelectedDate.format(), frontDate.format(), manualTimeScaleChangeUnit, gridWidth)// console.log(moment.utc(this.props.selectedDate).format(), moment.utc(prevProps.selectedDate).format())@@ -1279,7 +1280,7 @@ handleDragDragger = (draggerName, e, d) => {: null }{/* <div className="line" style={{transform: `translate(${this.state.leftOffset}px, 0px)`, display: this.state.showHoverLine ? 'block' : 'none'}}></div> */}<div className="dateToolTip" style={{transform: `translate(${this.state.draggerPosition - 5}px, -100px)`, display: this.state.showDraggerTime && this.state.draggerTimeState ? 'block' : 'none'}}>{this.state.showDraggerTime && this.state.draggerTimeState ? this.state.draggerTimeState : null}</div>-+{/* 404 is #timeline-header width and 10 is margin - parent offset issue most likely */}<div className="dateToolTip" style={{transform: `translate(${this.state.leftOffset - 52}px, -100px)`, display: !this.state.showDraggerTime && this.state.showHoverLine ? 'block' : 'none'}}>{!this.state.showDraggerTime && this.state.hoverTime ? this.state.hoverTime : null}</div>diff --git a/web/js/components/timeline/timeline-controls/date-zoom-change.js b/web/js/components/timeline/timeline-controls/date-zoom-change.jsindex c98c97a56..a3a2ffae8 100644--- a/web/js/components/timeline/timeline-controls/date-zoom-change.js+++ b/web/js/components/timeline/timeline-controls/date-zoom-change.js@@ -4,7 +4,9 @@ class DateZoomChange extends Component {constructor(props) {super(props);this.state = {- toolTipHovered: false+ toolTipHovered: false,+ intervalText: this.props.intervalText,+ customSelected: false}}@@ -16,11 +18,32 @@ class DateZoomChange extends Component {}handleClickZoom = (zoomSelected) => {+ console.log(zoomSelected)// close tooltip// send props function to change timescale zoom level throughout app- this.setState({- toolTipHovered: false- }, this.props.setTimeScale(zoomSelected));+ if (zoomSelected === 'custom') {+ let text = this.props.customIntervalText ? this.props.customIntervalText : 'Custom';+ this.setState({+ customSelected: true,+ toolTipHovered: false,+ intervalText: text+ }, this.props.setIntervalChangeUnitFromZoom(zoomSelected));+ } else {+ this.setState({+ customSelected: false,+ toolTipHovered: false,+ intervalText: zoomSelected+ }, this.props.setIntervalChangeUnitFromZoom(zoomSelected));+ }+ }++ componentDidUpdate(prevProps, prevState) {+ if (prevProps.intervalText !== this.props.intervalText) {+ this.setState({+ intervalText: this.props.intervalText+ })+ }+}render() {@@ -33,13 +56,13 @@ class DateZoomChange extends Component {{/* timeScale display */}<spanid="current-zoom"- className="zoom-btn zoom-btn-active"+ className={`zoom-btn zoom-btn-active${this.state.customSelected ? ' custom-interval-text' : ''}`}>- {this.props.timeScaleChangeUnit}+ {this.state.intervalText}</span>{/* hover timeScale unit dialog / entry point to Custom selector */}- <div className="wv-tooltip"+ <div className="wv-tooltip"style={{ display: this.state.toolTipHovered ? 'block' : 'none' }}><div id="timeline-zoom" className="timeline-zoom">@@ -48,36 +71,35 @@ class DateZoomChange extends Component {className="zoom-btn zoom-btn-inactive zoom-years"onClick={() => this.handleClickZoom('year')}>- Years+ Year</span><spanid="zoom-months"className="zoom-btn zoom-btn-inactive zoom-months"onClick={() => this.handleClickZoom('month')}>- Months+ Month</span><spanid="zoom-days"className="zoom-btn zoom-btn-inactive zoom-days"onClick={() => this.handleClickZoom('day')}>- Days+ Day</span><spanid="zoom-minutes"className="zoom-btn zoom-btn-inactive zoom-minutes"onClick={() => this.handleClickZoom('minute')}>- Minutes+ Minute</span><spanid="zoom-custom"- style={{color: '#7890cd'}}- className="zoom-btn zoom-btn-inactive zoom-custom"+ className="zoom-btn zoom-btn-inactive zoom-custom custom-interval-text"onClick={() => this.handleClickZoom('custom')}>- {this.props.customTimeInterval ? this.props.customTimeInterval : 'Custom'}+ {this.props.customIntervalText ? this.props.customIntervalText : 'Custom'}</span></div></div>diff --git a/web/js/components/timeline/timeline.css b/web/js/components/timeline/timeline.cssindex 2008100d5..1c6f507d0 100644--- a/web/js/components/timeline/timeline.css+++ b/web/js/components/timeline/timeline.css@@ -190,6 +190,10 @@ form select {margin-right: 15px;}+.custom-interval-text {+ color: #7890cd !important;+}+#set-interval-button {}@@ -229,6 +233,10 @@ form select {background: rgba(40, 40, 40, 0.9);}+.date-arrow-wrapper {+ width: 80px;+}+/* DEMO DOM CLEANUP *//* #timeline-footer-svg {diff --git a/web/js/components/timeline/timeline.js b/web/js/components/timeline/timeline.jsindex 15d70653c..8622840c1 100644--- a/web/js/components/timeline/timeline.js+++ b/web/js/components/timeline/timeline.js@@ -17,18 +17,21 @@ class Timeline extends React.Component {super(props);this.state = {dateFormatted: '',- width: '',+ timelineWidth: '',selectedDate: '',changeDate: '',timeScale: '',incrementDate: '',timeScaleChangeUnit: '',changeAmt: '',+ intervalText: '',customIntervalValue: '',customIntervalZoomLevel: '',+ customIntervalText: '',+ hasSubdailyLayers: '',customIntervalModalOpen: false,inputChange: false,- timelineHidden: false+ timelineHidden: false,};}@@ -46,7 +49,7 @@ class Timeline extends React.Component {// }updateDate = (date, inputChange) => {- console.log(date)+ console.log(date, inputChange)if (inputChange) {this.setState({inputChange: true@@ -74,7 +77,7 @@ class Timeline extends React.Component {}));}- componentDidUpdate() {+ componentDidUpdate(prevProps, prevState) {// console.log('CDU', this.state, this.props)}@@ -85,7 +88,7 @@ class Timeline extends React.Component {init = () => {this.setState({dateFormatted: this.props.selectedDate.toISOString(),- width: this.props.width,+ timelineWidth: this.props.timelineWidth,selectedDate: this.props.selectedDate.toISOString(),changeDate: this.props.changeDate,timeScale: this.props.timeScale,@@ -93,7 +96,9 @@ class Timeline extends React.Component {timeScaleChangeUnit: this.props.timeScale,changeAmt: 1,customIntervalValue: 1,- customIntervalZoomLevel: this.props.timeScale+ customIntervalZoomLevel: this.props.timeScale,+ hasSubdailyLayers: this.props.hasSubdailyLayers,+ intervalText: this.props.timeScale});}@@ -104,25 +109,46 @@ class Timeline extends React.Component {}, this.props.setIntervalInput(intervalValue, zoomLevel));}- setTimeScale = (timeScaleChangeUnit) => {+ setIntervalChangeUnit = (intervalValue, zoomLevel) => {+ const timeUnitAbbreviations = {+ year: 'year',+ month: 'mon',+ day: 'day',+ hour: 'hour',+ minute: 'min'+ };++ let timeScaleChangeUnitString = `${intervalValue} ${timeUnitAbbreviations[zoomLevel]}`;- if (timeScaleChangeUnit === 'custom') {- console.log(timeScaleChangeUnit)- // let toggle = this.state.customIntervalModalOpen;- // console.log(toggle)- // this.setState({- // customIntervalModalOpen: toggle- // })+ this.setState({+ customIntervalText: timeScaleChangeUnitString,+ intervalText: timeScaleChangeUnitString,+ customIntervalValue: intervalValue,+ customIntervalZoomLevel: zoomLevel,+ changeAmt: intervalValue,+ timeScaleChangeUnit: zoomLevel+ })+ }++ setIntervalChangeUnitFromZoom = (customIntervalChangeUnit) => {+ if (customIntervalChangeUnit === 'custom') {+ this.setState({+ intervalText: this.state.customIntervalText ? this.state.customIntervalText : 'Custom',+ changeAmt: this.state.customIntervalValue ? this.state.customIntervalValue : 1,+ timeScaleChangeUnit: this.state.customIntervalZoomLevel ? this.state.customIntervalZoomLevel : this.state.timeScale+ })} else {this.setState({- timeScaleChangeUnit: timeScaleChangeUnit+ intervalText: customIntervalChangeUnit,+ changeAmt: 1,+ timeScaleChangeUnit: customIntervalChangeUnit})}}-// left/right arrows increment dateincrementDate = (multiplier) => {- this.props.incrementDate((multiplier * this.state.customIntervalValue), this.state.customIntervalZoomLevel);+ console.log(this.state.changeAmt, this.state.timeScaleChangeUnit)+ this.props.incrementDate((multiplier * this.state.changeAmt), this.state.timeScaleChangeUnit);}// open animation dialog@@ -132,7 +158,6 @@ class Timeline extends React.Component {// toggle hide timelinetoggleHideTimeline = () => {- console.log('hey')this.setState({timelineHidden: !this.state.timelineHidden}, this.props.toggleHideTimeline());@@ -152,21 +177,26 @@ class Timeline extends React.Component {render() {console.log(this.props.selectedDate, this.props.dateFormatted, this.state.dateFormatted, this.props)console.log(this.state)+ console.log(this.props.hasSubdailyLayers, this.state.hasSubdailyLayers)+ console.log(this.props)return (this.state.dateFormatted ?<React.Fragment>- <div id="timeline-header">+ <div id="timeline-header" className={this.state.hasSubdailyLayers ? 'subdaily' : ''}><div id="date-selector-main"><DateSelector- {...this.props.inputProps}+ {...this.props}onDateChange={this.updateDate}date={new Date(this.state.dateFormatted)}+ hasSubdailyLayers={this.state.hasSubdailyLayers}/></div><div id="zoom-buttons-group"><DateZoomChange- timeScaleChangeUnit={this.state.timeScaleChangeUnit}- setTimeScale={this.setTimeScale}+ // timeScaleChangeUnit={this.state.timeScaleChangeUnit}+ setIntervalChangeUnitFromZoom={this.setIntervalChangeUnitFromZoom}+ intervalText={this.state.intervalText}+ customIntervalText={this.state.customIntervalText}/>{/* </div> */}@@ -182,6 +212,7 @@ class Timeline extends React.Component {customIntervalZoomLevel={this.props.timeScale}toggleCustomIntervalModal={this.toggleCustomIntervalModal}customIntervalModalOpen={this.state.customIntervalModalOpen}+ setIntervalChangeUnit={this.setIntervalChangeUnit}/><DateChangeArrows@@ -212,7 +243,7 @@ class Timeline extends React.Component {</div>{/* hammmmmmmmmmmburger 🍔 */}- <div className="timeline-hamburger-date">DAY</div>+ {/* <div className="timeline-hamburger-date">DAY</div> */}<div id="timeline-hide" onClick={this.toggleHideTimeline}>{this.state.timelineHidden ?<i className="far fa-caret-square-right wv-timeline-hide-arrow"></i>diff --git a/web/js/date/model.js b/web/js/date/model.jsindex f52286387..1508a598a 100644--- a/web/js/date/model.js+++ b/web/js/date/model.js@@ -42,7 +42,7 @@ export function dateModel(models, config, spec) {};self.select = function(date, selectionStr) {- console.log(date)+ console.log(date, self.selected)if (!date) return null;selectionStr = selectionStr || self.activeDate;date = self.clamp(date);@@ -61,7 +61,10 @@ export function dateModel(models, config, spec) {};self.add = function(interval, amount, selectionStr) {+ console.log(interval, amount, selectionStr)selectionStr = selectionStr || self.activeDate;+ console.log(interval, amount, selectionStr)+ console.log(self[selectionStr])self.select(util.dateAdd(self[selectionStr], interval, amount),selectionStr@@ -85,6 +88,7 @@ export function dateModel(models, config, spec) {date = startDate;}}+ console.log(date)return date;};diff --git a/web/js/date/timeline-data.js b/web/js/date/timeline-data.jsindex 3826b2c55..ffc9fa67d 100644--- a/web/js/date/timeline-data.js+++ b/web/js/date/timeline-data.js@@ -15,93 +15,93 @@ export function timelineData(models, config, ui) {};self.set = function() {- var futureLayers = [];- var activeLayers = models.layers.get({});- var activeLayersDynamic = activeLayers.filter(function(al) {- return al.startDate;- });- /* var activeLayersInvisible = activeLayers.filter(function(al){- return al.visible === false;- }); */- var activeLayersTitles = [];- var layerCount = activeLayersDynamic.length;+ // var futureLayers = [];+ // var activeLayers = models.layers.get({});+ // var activeLayersDynamic = activeLayers.filter(function(al) {+ // return al.startDate;+ // });+ // /* var activeLayersInvisible = activeLayers.filter(function(al){+ // return al.visible === false;+ // }); */+ // var activeLayersTitles = [];+ // var layerCount = activeLayersDynamic.length;- tl.dataBars.selectAll('rect').remove();+ // // tl.dataBars.selectAll('rect').remove();- $(activeLayersDynamic).each(function(i) {- activeLayersTitles[i] = this.id;- if (this.futureLayer === true) {- futureLayers.push(this.id);- }- });+ // $(activeLayersDynamic).each(function(i) {+ // activeLayersTitles[i] = this.id;+ // if (this.futureLayer === true) {+ // futureLayers.push(this.id);+ // }+ // });- tl.y = d3.scale- .ordinal()- .domain(activeLayersTitles)- .rangeBands([5, tl.height - 12]);+ // // tl.y = d3.scale+ // // .ordinal()+ // // .domain(activeLayersTitles)+ // // .rangeBands([5, tl.height - 12]);- tl.yAxis = d3.svg- .axis()- .scale(tl.y)- .orient('left')- .ticks(layerCount);+ // // tl.yAxis = d3.svg+ // // .axis()+ // // .scale(tl.y)+ // // .orient('left')+ // // .ticks(layerCount);- $(activeLayersDynamic).each(function(al) {- var layerStart, layerEnd;- var staticLayer = true;- var layerId = this.id;+ // $(activeLayersDynamic).each(function(al) {+ // var layerStart, layerEnd;+ // var staticLayer = true;+ // var layerId = this.id;- if (this.startDate) {- layerStart = new Date(this.startDate);- staticLayer = false;- } else {- layerStart = self.start();- }+ // if (this.startDate) {+ // layerStart = new Date(this.startDate);+ // staticLayer = false;+ // } else {+ // layerStart = self.start();+ // }- if (this.inactive === true || this.futureLayer === true) {- layerEnd = new Date(this.endDate);- if (this.futureTime) {- layerEnd = util.now();- var futureTime = this.futureTime;- var dateType = futureTime.slice(-1);- var dateInterval = futureTime.slice(0, -1);- if (dateType === 'D') {- layerEnd.setDate(layerEnd.getDate() + parseInt(dateInterval));- } else if (dateType === 'M') {- layerEnd.setMonth(layerEnd.getMonth() + parseInt(dateInterval));- } else if (dateType === 'Y') {- layerEnd.setYear(layerEnd.getYear() + parseInt(dateInterval));- }- }- } else if (Array.isArray(futureLayers) && futureLayers.length) {- layerEnd = util.now();- } else {- layerEnd = new Date(self.end().setUTCDate(self.end().getUTCDate() + 1));- }+ // if (this.inactive === true || this.futureLayer === true) {+ // layerEnd = new Date(this.endDate);+ // if (this.futureTime) {+ // layerEnd = util.now();+ // var futureTime = this.futureTime;+ // var dateType = futureTime.slice(-1);+ // var dateInterval = futureTime.slice(0, -1);+ // if (dateType === 'D') {+ // layerEnd.setDate(layerEnd.getDate() + parseInt(dateInterval));+ // } else if (dateType === 'M') {+ // layerEnd.setMonth(layerEnd.getMonth() + parseInt(dateInterval));+ // } else if (dateType === 'Y') {+ // layerEnd.setYear(layerEnd.getYear() + parseInt(dateInterval));+ // }+ // }+ // } else if (Array.isArray(futureLayers) && futureLayers.length) {+ // layerEnd = util.now();+ // } else {+ // layerEnd = new Date(self.end().setUTCDate(self.end().getUTCDate() + 1));+ // }- var currentDB = tl.dataBars- .append('svg:rect')- .attr('x', tl.x(layerStart))- .attr('width', tl.x(layerEnd) - tl.x(layerStart))- // .attr('height',2)- .attr('y', tl.y(layerId) - 2.5)- .attr('rx', 4)- .attr('ry', 4)- .attr('data-layer', layerId)- .attr('class', 'data-bar');- // .attr("d", selection);- if (!staticLayer) {- currentDB.classed('data-bar-dyn', true);- }- if (this.visible === false) {- currentDB.classed('data-bar-invisible', true);- }- });- tl.dataBars.selectAll('rect').attr('height', (tl.height - 22) / layerCount);+ // // var currentDB = tl.dataBars+ // // .append('svg:rect')+ // // .attr('x', tl.x(layerStart))+ // // .attr('width', tl.x(layerEnd) - tl.x(layerStart))+ // // // .attr('height',2)+ // // .attr('y', tl.y(layerId) - 2.5)+ // // .attr('rx', 4)+ // // .attr('ry', 4)+ // // .attr('data-layer', layerId)+ // // .attr('class', 'data-bar');+ // // // .attr("d", selection);+ // // if (!staticLayer) {+ // // currentDB.classed('data-bar-dyn', true);+ // // }+ // // if (this.visible === false) {+ // // currentDB.classed('data-bar-invisible', true);+ // // }+ // });+ // // tl.dataBars.selectAll('rect').attr('height', (tl.height - 22) / layerCount);- if (tl.verticalAxis) {- tl.verticalAxis.call(tl.yAxis);- }+ // // if (tl.verticalAxis) {+ // // tl.verticalAxis.call(tl.yAxis);+ // // }};var init = function() {};diff --git a/web/js/date/timeline.js b/web/js/date/timeline.jsindex 986170d78..a0db3a7b6 100644--- a/web/js/date/timeline.js+++ b/web/js/date/timeline.js@@ -150,15 +150,20 @@ export function timeline(models, config, ui) {};var updateMaxZoom = function() {- if (model.maxZoom >= 4) {- document.getElementById('timeline-header').classList.add('subdaily');+ let subdaily = models.layers.hasSubDaily();++ // if (model.maxZoom >= 4) {+ if (subdaily) {+ // document.getElementById('timeline-header').classList.add('subdaily');} else {- if (ui.timeline && ui.timeline.config.currentZoom > 3) {+ // if (ui.timeline && ui.timeline.config.currentZoom > 3) {+ if (ui.timeline && !subdaily) {document.getElementById('zoom-days').click();}- document.getElementById('timeline-header').classList.remove('subdaily');+ // document.getElementById('timeline-header').classList.remove('subdaily');}- self.reactComponent.setState({ maxZoom: model.maxZoom });++ // self.reactComponent.setState({ maxZoom: model.maxZoom });// model.events.trigger('update-timewheel');};@@ -225,11 +230,11 @@ export function timeline(models, config, ui) {var min = model.minDate();var max = model.maxDate();var date = model[model.activeDate];- var maxZoom = model.maxZoom;- if (model.maxZoom >= 4 || config.parameters.showSubdaily) {- document.getElementById('timeline-header').classList.add('subdaily');- maxZoom = 4;- }+ // var maxZoom = model.maxZoom;+ // if (model.maxZoom >= 4 || config.parameters.showSubdaily) {+ // document.getElementById('timeline-header').classList.add('subdaily');+ // maxZoom = 4;+ // }return {width: '120',@@ -238,7 +243,7 @@ export function timeline(models, config, ui) {idSuffix: 'animation-widget-main',minDate: min,maxDate: max,- maxZoom: maxZoom,+ // maxZoom: maxZoom,// onDateChange: onDateSelect,date: date,fontSize: null@@ -266,6 +271,8 @@ export function timeline(models, config, ui) {var endDate = models.layers.lastDate();self.delta = Math.abs(delta);+ let subdaily = models.layers.hasSubDaily();+function animate() {var nextTime = getNextTimeSelection(delta, increment);// console.log(tl.data.start(), nextTime, endTime, increment)@@ -417,7 +424,7 @@ export function timeline(models, config, ui) {// self.axis.select('line:first-child').attr('x2', self.width);}- self.reactComponent.setState({ width: self.getWidth() });+ self.reactComponent.setState({ timelineWidth: self.getWidth() });};self.setClip = function() {@@ -442,15 +449,22 @@ export function timeline(models, config, ui) {var incrementDate = (increment, timeScale) => {// self.expand(true);- console.log(increment, timeScale)+ // console.log(increment, timeScale)self.animateByIncrement(increment, timeScale);+ // let newDate = models.date[models.date.activeDate];+ // console.log('XXXXX', newDate);// models.date.add(timeScale, increment);// self.input.animateByIncrement(increment, timeScale);// models.date.select(date);+ // self.reactComponent.setState({+ // selectedDate: newDate,+ // dateFormatted: new Date(newDate).toISOString()+ // });};var updateDate = (date) => {let updatedDate = new Date(date);+ console.log(date)// console.log(models)// self.input.update(updatedDate);// models.date.setActiveDate(updatedDate);@@ -473,19 +487,17 @@ export function timeline(models, config, ui) {console.log(ui);};--var getInitialProps = () => {// console.log(self)let selectedDate = models.date[models.date.activeDate];let subdaily = models.layers.hasSubDaily();let inputProps = getInputProps();- return {- width: self.width,+ return Object.assign(inputProps, {+ timelineWidth: self.width,parentOffset: self.parentOffset,- subdailyLayers: subdaily,- height: self.height,+ hasSubdailyLayers: subdaily,+ timelineHeight: self.height,selectedDate: selectedDate,// changeDate: changeDate,timeScale: 'day',@@ -493,11 +505,10 @@ export function timeline(models, config, ui) {updateDate: updateDate,setIntervalInput: setIntervalInput,dateFormatted: new Date(selectedDate).toISOString(),- inputProps: inputProps,stopper: stopper,clickAnimationButton: clickAnimationButton,toggleHideTimeline: self.toggle- };+ });};var drawContainers = function() {@@ -584,7 +595,7 @@ export function timeline(models, config, ui) {// debugger;let selectedDate = models.date[models.date.activeDate];// console.log(selectedDate, new Date(selectedDate).toISOString())- // console.log(selectedDate);+ console.log(selectedDate);self.reactComponent.setState({selectedDate: selectedDate,dateFormatted: new Date(selectedDate).toISOString()@@ -592,23 +603,36 @@ export function timeline(models, config, ui) {};var updateTimeUi = function() {- console.log('%c updateTimeUi ', 'background: #555; color: cornflowerblue');+ // console.log('%c updateTimeUi ', 'background: #555; color: cornflowerblue');updateReactTimelineDate();// updateInput();// self.input.update();// self.pick.shiftView();};++ // Update status of subdaily layers being in sidebar+ var updateSubdailyState = function() {+ let subdaily = models.layers.hasSubDaily();+ self.reactComponent.setState({ hasSubdailyLayers: subdaily });+ };+var onLayerUpdate = function() {- const layersContainSubdaily = models.layers.hasSubDaily();+ // const layersContainSubdaily = models.layers.hasSubDaily();++ // let subdaily = models.layers.hasSubDaily();+self.data.set();self.resize();- self.setClip();- if (subdaily !== layersContainSubdaily) {- // self.zoom.refresh();- self.input.update();- subdaily = layersContainSubdaily;- }+ // self.setClip();+ // if (subdaily !== layersContainSubdaily) {+ // // self.zoom.refresh();+ // self.input.update();+ // subdaily = layersContainSubdaily;+ // }+ // console.log(ui.anim)+ ui.anim.widget.update();+ updateSubdailyState();};var init = function() {var $timelineFooter = $('#timeline-footer');@@ -673,7 +697,7 @@ export function timeline(models, config, ui) {$(window).resize(function() {self.resize();// self.zoom.refresh();- self.setClip();+ // self.setClip();});model.events.on('select', updateTimeUi);model.events.on('state-update', updateTimeUi);@@ -696,7 +720,7 @@ export function timeline(models, config, ui) {models.proj.events.on('select', function() {self.resize();- self.setClip();+ // self.setClip();onLayerUpdate();});};diff --git a/web/js/util/util.js b/web/js/util/util.jsindex c757ec820..c07e3fbd3 100644--- a/web/js/util/util.js+++ b/web/js/util/util.js@@ -592,6 +592,7 @@ export default (function (self) {};self.rollDate = function (date, interval, amount, minDate, maxDate) {+ console.log(date, interval, amount, minDate, maxDate)minDate = minDate || self.minDate();maxDate = maxDate || self.maxDate();var range = self.rollRange(date, interval, minDate, maxDate);@@ -632,6 +633,7 @@ export default (function (self) {}var newDate = new Date(Date.UTC(year, month, day, hour, minute, second));newDate = new Date(self.clamp(newDate, minDate, maxDate));+ console.log(newDate)return newDate;};