Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

disabled animation controls while playing

Jason Kent8d516c59e439
diff --git a/web/css/anim.widget.css b/web/css/anim.widget.css
index 5495ea792..ce93ee79f 100644
--- a/web/css/anim.widget.css
+++ b/web/css/anim.widget.css
@@ -7,6 +7,9 @@
left: 10px;
}
}
+.wv-animation-widget .input-range.rc-slider-disabled {
+ cursor: default;
+}
.wv-animation-widget {
width: 334px;
border-radius: 5px;
@@ -30,6 +33,9 @@
& .interval-btn.interval-btn-active {
color: #ce4c21;
display: inline;
+ &.disabled {
+ color: #fff;
+ }
}
& .wv-tooltip {
bottom: 128px;
diff --git a/web/css/dateselector.css b/web/css/dateselector.css
index b68e03326..7a717de91 100644
--- a/web/css/dateselector.css
+++ b/web/css/dateselector.css
@@ -17,44 +17,66 @@
.wv-date-selector-widget .input-wrapper:nth-child(4) {
max-width: 35px;
}
-
-.wv-date-selector-widget input {
- color: #fff;
- background: transparent;
- border: 0;
- font-family: "Roboto Mono", monospace;
- vertical-align: middle;
- box-sizing: border-box;
- -moz-box-sizing: border-box;
- -webkit-box-sizing: border-box;
- padding: 0;
- height: inherit;
- text-align: center;
- width: 100%;
-}
-
-.wv-date-selector-widget .input-wrapper:hover {
- border-color: #666;
-}
-
-.wv-date-selector-widget .input-wrapper:hover .date-arrows {
- visibility: visible;
-}
-
-.wv-date-selector-widget .input-wrapper:hover .date-arrows svg path {
- fill: #888;
-}
-
-.wv-date-selector-widget .input-wrapper.selected {
- border-color: #fff;
-}
-
-.wv-date-selector-widget .input-wrapper.selected .date-arrows svg path {
- fill: #fff;
+.disabled .wv-date-selector-widget .input-wrapper {
+ &:hover {
+ border: 1px solid transparent;
+ }
+ input {
+ cursor: default;
+ }
+ .date-arrows {
+ &:hover {
+ background-color: transparent;
+ cursor: default;
+ }
+ svg path {
+ visibility: hidden;
+ }
+ }
}
-.wv-date-selector-widget div {
- display: inline-block;
+.wv-date-selector-widget {
+ div {
+ display: inline-block;
+ }
+ input {
+ color: #fff;
+ background: transparent;
+ border: 0;
+ font-family: "Roboto Mono", monospace;
+ vertical-align: middle;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ padding: 0;
+ height: inherit;
+ text-align: center;
+ width: 100%;
+ }
+ .input-wrapper:hover {
+ border-color: #666;
+ &.disabled {
+ border-color: transparent;
+ }
+ .date-arrows {
+ visibility: visible;
+ &.disabled {
+ visibility: hidden;
+ }
+ }
+ .date-arrows svg path {
+ fill: #888;
+ &.disabled {
+ fill: trasparent
+ }
+ }
+ }
+ .input-wrapper.selected {
+ border-color: #fff;
+ .date-arrows svg path {
+ fill: #fff;
+ }
+ }
}
.button-action-group {
diff --git a/web/css/rc-slider-overrides.css b/web/css/rc-slider-overrides.css
index d736a96f0..f2633ce3a 100644
--- a/web/css/rc-slider-overrides.css
+++ b/web/css/rc-slider-overrides.css
@@ -18,3 +18,17 @@
.rc-slider-tooltip-inner {
min-width: 40px;
}
+
+.rc-slider-disabled {
+ background: transparent;
+ cursor: default;
+ .rc-slider-handle {
+ background: #999;
+ }
+ .rc-slider-rail {
+ background: #666;
+ }
+ .rc-slider-track {
+ background: #666;
+ }
+}
diff --git a/web/css/timeline.css b/web/css/timeline.css
index 0705d50c0..3a8592c7d 100644
--- a/web/css/timeline.css
+++ b/web/css/timeline.css
@@ -507,6 +507,11 @@ button:focus {
.interval-btn-active:hover {
background-color: #fff;
color: #1a1a1a;
+ &.disabled {
+ background-color: transparent;
+ color: #ccc;
+ cursor: default;
+ }
}
.zoom-btn, .interval-btn {
diff --git a/web/js/components/date-selector/date-input-column.js b/web/js/components/date-selector/date-input-column.js
index 57706613f..d4f27e0d3 100644
--- a/web/js/components/date-selector/date-input-column.js
+++ b/web/js/components/date-selector/date-input-column.js
@@ -219,8 +219,9 @@ class DateInputColumn extends Component {
rollDate = (amt) => {
const {
- date, minDate, maxDate, type, updateDate,
+ date, minDate, maxDate, type, updateDate, isDisabled,
} = this.props;
+ if (isDisabled) return;
const newDate = util.rollDate(
date,
type,
@@ -278,6 +279,7 @@ class DateInputColumn extends Component {
isValid,
isStartDate,
isEndDate,
+ isDisabled,
type,
} = this.props;
const {
@@ -304,7 +306,7 @@ class DateInputColumn extends Component {
>
<Arrow
direction="up"
- onClick={() => this.rollDate(1)}
+ onClick={isDisabled ? () => {} : () => this.rollDate(1)}
type={type}
/>
<input
@@ -322,10 +324,11 @@ class DateInputColumn extends Component {
onTouchCancel={this.blur}
onFocus={this.handleFocus}
onTouchStart={this.handleFocus}
+ disabled={isDisabled}
/>
<Arrow
direction="down"
- onClick={() => this.rollDate(-1)}
+ onClick={isDisabled ? () => {} : () => this.rollDate(-1)}
type={type}
/>
</div>
@@ -340,6 +343,7 @@ DateInputColumn.propTypes = {
isValid: PropTypes.bool,
isStartDate: PropTypes.bool,
isEndDate: PropTypes.bool,
+ isDisabled: PropTypes.bool,
maxDate: PropTypes.object,
minDate: PropTypes.object,
onFocus: PropTypes.func,
diff --git a/web/js/components/date-selector/date-range-selector.js b/web/js/components/date-selector/date-range-selector.js
index be222a99e..91b3164dd 100644
--- a/web/js/components/date-selector/date-range-selector.js
+++ b/web/js/components/date-selector/date-range-selector.js
@@ -4,7 +4,7 @@ import DateSelector from './date-selector';
export default function DateRangeSelector (props) {
const {
- startDate, endDate, setDateRange, minDate, maxDate, subDailyMode, idSuffix,
+ startDate, endDate, setDateRange, minDate, maxDate, subDailyMode, idSuffix, isDisabled,
} = props;
const setStartDate = (newStart) => {
@@ -13,8 +13,12 @@ export default function DateRangeSelector (props) {
const setEndDate = (newEnd) => {
setDateRange([startDate, newEnd]);
};
+ const className = isDisabled
+ ? 'wv-date-range-selector disabled'
+ : 'wv-date-range-selector';
+
return (
- <div className="wv-date-range-selector">
+ <div className={className}>
<DateSelector
idSuffix={idSuffix}
date={startDate}
@@ -22,6 +26,7 @@ export default function DateRangeSelector (props) {
minDate={minDate}
maxDate={endDate}
subDailyMode={subDailyMode}
+ isDisabled={isDisabled}
isStartDate
/>
<div className="thru-label">to</div>
@@ -32,6 +37,7 @@ export default function DateRangeSelector (props) {
maxDate={maxDate}
minDate={startDate}
subDailyMode={subDailyMode}
+ isDisabled={isDisabled}
isEndDate
/>
</div>
@@ -40,6 +46,7 @@ export default function DateRangeSelector (props) {
DateRangeSelector.propTypes = {
idSuffix: PropTypes.string,
+ isDisabled: PropTypes.bool,
startDate: PropTypes.object,
endDate: PropTypes.object,
setDateRange: PropTypes.func,
diff --git a/web/js/components/date-selector/date-selector.js b/web/js/components/date-selector/date-selector.js
index f84de8a71..4befe3563 100644
--- a/web/js/components/date-selector/date-selector.js
+++ b/web/js/components/date-selector/date-selector.js
@@ -28,43 +28,6 @@ class DateSelector extends Component {
};
}
- shouldComponentUpdate(nextProps, nextState) {
- const {
- date,
- subDailyMode,
- maxDate,
- minDate,
- } = this.props;
- const {
- year,
- month,
- day,
- hour,
- minute,
- yearValid,
- monthValid,
- dayValid,
- hourValid,
- minuteValid,
- } = this.state;
-
- const updateCheck = year === nextState.year
- && month === nextState.month
- && day === nextState.day
- && hour === nextState.hour
- && minute === nextState.minute
- && yearValid === nextState.yearValid
- && monthValid === nextState.monthValid
- && dayValid === nextState.dayValid
- && hourValid === nextState.hourValid
- && minuteValid === nextState.minuteValid
- && date.getTime() === nextProps.date.getTime()
- && subDailyMode === nextProps.subDailyMode
- && maxDate.getTime() === nextProps.maxDate.getTime()
- && minDate.getTime() === nextProps.minDate.getTime();
- return !updateCheck;
- }
-
componentDidUpdate(prevProps) {
const {
date,
@@ -342,6 +305,7 @@ class DateSelector extends Component {
subDailyMode,
isStartDate,
isEndDate,
+ isDisabled,
} = this.props;
const {
year,
@@ -382,18 +346,21 @@ class DateSelector extends Component {
type="year"
value={yearValue}
isValid={yearValid}
+ isDisabled={isDisabled}
/>
<DateInputColumn
{...sharedProps}
type="month"
value={monthValue}
isValid={monthValid}
+ isDisabled={isDisabled}
/>
<DateInputColumn
{...sharedProps}
type="day"
value={dayValue}
isValid={dayValid}
+ isDisabled={isDisabled}
/>
{ subDailyMode && (
<>
@@ -402,6 +369,7 @@ class DateSelector extends Component {
type="hour"
value={hourValue}
isValid={hourValid}
+ isDisabled={isDisabled}
/>
<div className="input-time-divider">:</div>
<DateInputColumn
@@ -409,6 +377,7 @@ class DateSelector extends Component {
type="minute"
value={minuteValue}
isValid={minuteValid}
+ isDisabled={isDisabled}
/>
<div className="input-time-zmark">Z</div>
</>
@@ -426,6 +395,7 @@ DateSelector.propTypes = {
idSuffix: PropTypes.string,
isStartDate: PropTypes.bool,
isEndDate: PropTypes.bool,
+ isDisabled: PropTypes.bool,
maxDate: PropTypes.object,
minDate: PropTypes.object,
onDateChange: PropTypes.func,
diff --git a/web/js/components/timeline/timeline-controls/timescale-interval-change.js b/web/js/components/timeline/timeline-controls/timescale-interval-change.js
index 280bb718f..e46febaae 100644
--- a/web/js/components/timeline/timeline-controls/timescale-interval-change.js
+++ b/web/js/components/timeline/timeline-controls/timescale-interval-change.js
@@ -57,15 +57,11 @@ class TimeScaleIntervalChange extends PureComponent {
}
}
- toolTipHoverOn = () => {
+ setTooltipState = (hovered) => {
+ const { isDisabled } = this.props;
+ if (isDisabled) return;
this.setState({
- toolTipHovered: true,
- });
- }
-
- toolTipHoverOff = () => {
- this.setState({
- toolTipHovered: false,
+ toolTipHovered: hovered,
});
}
@@ -126,95 +122,104 @@ class TimeScaleIntervalChange extends PureComponent {
});
}
+ renderTooltip = () => {
+ const { toolTipHovered, customIntervalText } = this.state;
+ const { hasSubdailyLayers } = this.props;
+ return (
+ <div
+ className="wv-tooltip"
+ style={{ display: toolTipHovered ? 'block' : 'none' }}
+ >
+ <div id="timeline-interval" className="timeline-interval">
+ <span
+ id="interval-years"
+ className="interval-btn interval-years"
+ onClick={() => this.handleClickInterval('year')}
+ >
+ Year
+ </span>
+ <span
+ id="interval-months"
+ className="interval-btn interval-months"
+ onClick={() => this.handleClickInterval('month')}
+ >
+ Month
+ </span>
+ <span
+ id="interval-days"
+ className="interval-btn interval-days"
+ onClick={() => this.handleClickInterval('day')}
+ >
+ Day
+ </span>
+ {hasSubdailyLayers ? (
+ <>
+ <span
+ id="interval-hours"
+ className="interval-btn interval-hours"
+ onClick={() => this.handleClickInterval('hour')}
+ >
+ Hour
+ </span>
+ <span
+ id="interval-minutes"
+ className="interval-btn interval-minutes"
+ onClick={() => this.handleClickInterval('minute')}
+ >
+ Minute
+ </span>
+ </>
+ ) : null}
+ <span
+ id="interval-custom"
+ className="interval-btn interval-custom custom-interval-text"
+ style={{ display: customIntervalText === 'Custom' ? 'none' : 'block' }}
+ onClick={() => this.handleClickInterval('custom')}
+ >
+ {customIntervalText}
+ </span>
+ <span
+ id="interval-custom-static"
+ className="interval-btn interval-custom custom-interval-text"
+ onClick={() => this.handleClickInterval('custom', true)}
+ >
+ Custom
+ </span>
+ </div>
+ </div>
+ );
+ }
+
render() {
const {
customIntervalText,
- toolTipHovered,
} = this.state;
const {
customSelected,
- hasSubdailyLayers,
interval,
+ isDisabled,
} = this.props;
+
+ const className = `no-drag interval-btn interval-btn-active${customSelected ? ' custom-interval-text' : ''} ${isDisabled ? ' disabled' : ''}`;
return (
<>
<div
id="timeline-interval-btn-container"
className="interval-btn-container noselect no-drag"
- onMouseEnter={this.toolTipHoverOn}
- onMouseLeave={this.toolTipHoverOff}
+ onMouseEnter={() => this.setTooltipState(true)}
+ onMouseLeave={() => this.setTooltipState(false)}
onClick={this.onClick}
>
- {/* timeScale display */}
+
<span
id="current-interval"
- className={`no-drag interval-btn interval-btn-active${customSelected ? ' custom-interval-text' : ''}`}
+ className={className}
>
{customSelected ? customIntervalText : `${1} ${TIME_SCALE_FROM_NUMBER[interval]}`}
</span>
- {/* hover timeScale unit dialog / entry point to Custom selector */}
- <div
- className="wv-tooltip"
- style={{ display: toolTipHovered ? 'block' : 'none' }}
- >
- <div id="timeline-interval" className="timeline-interval">
- <span
- id="interval-years"
- className="interval-btn interval-years"
- onClick={() => this.handleClickInterval('year')}
- >
- Year
- </span>
- <span
- id="interval-months"
- className="interval-btn interval-months"
- onClick={() => this.handleClickInterval('month')}
- >
- Month
- </span>
- <span
- id="interval-days"
- className="interval-btn interval-days"
- onClick={() => this.handleClickInterval('day')}
- >
- Day
- </span>
- {hasSubdailyLayers ? (
- <>
- <span
- id="interval-hours"
- className="interval-btn interval-hours"
- onClick={() => this.handleClickInterval('hour')}
- >
- Hour
- </span>
- <span
- id="interval-minutes"
- className="interval-btn interval-minutes"
- onClick={() => this.handleClickInterval('minute')}
- >
- Minute
- </span>
- </>
- ) : null}
- <span
- id="interval-custom"
- className="interval-btn interval-custom custom-interval-text"
- style={{ display: customIntervalText === 'Custom' ? 'none' : 'block' }}
- onClick={() => this.handleClickInterval('custom')}
- >
- {customIntervalText}
- </span>
- <span
- id="interval-custom-static"
- className="interval-btn interval-custom custom-interval-text"
- onClick={() => this.handleClickInterval('custom', true)}
- >
- Custom
- </span>
- </div>
- </div>
+ {!isDisabled ? this.renderTooltip() : null}
+
</div>
</>
);
@@ -249,6 +254,7 @@ TimeScaleIntervalChange.propTypes = {
customSelected: PropTypes.bool,
hasSubdailyLayers: PropTypes.bool,
interval: PropTypes.number,
+ isDisabled: PropTypes.bool,
selectInterval: PropTypes.func,
timeScaleChangeUnit: PropTypes.string,
toggleCustomModal: PropTypes.func,
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index f1de33bce..a4e1a8475 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -493,6 +493,7 @@ class AnimationWidget extends React.Component {
timeScaleChangeUnit={interval}
hasSubdailyLayers={hasSubdailyLayers}
modalType={customModalType.ANIMATION}
+ isDisabled={isPlaying}
/>
{' Increments'}
</div>
@@ -521,6 +522,7 @@ class AnimationWidget extends React.Component {
onChange={(num) => this.setState({ speed: num })}
handle={RangeHandle}
onAfterChange={() => { onSlide(speed); }}
+ disabled={isPlaying}
/>
<span className="wv-slider-label">{sliderLabel}</span>
</div>
@@ -537,6 +539,7 @@ class AnimationWidget extends React.Component {
minDate={minDate}
maxDate={maxDate}
subDailyMode={subDailyMode}
+ isDisabled={isPlaying}
/>
<FontAwesomeIcon icon="chevron-down" className="wv-minimize" onClick={this.toggleCollapse} />