Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

use bootstrap tooltips for date arrows, zoom map buttons, and style for embed desktop

Ed Plato9cf193a227b7
diff --git a/web/css/embed.css b/web/css/embed.css
index 00dde086c..184df1867 100644
--- a/web/css/embed.css
+++ b/web/css/embed.css
@@ -118,6 +118,10 @@
transform: scale(0.75);
transform-origin: bottom left;
}
+ .mobile-date-picker-select-btn:hover {
+ color: #000;
+ background-color: #fff;
+ }
.mobile-date-change-arrows-btn {
left: 168px;
transform: scale(0.75);
diff --git a/web/css/timeline.css b/web/css/timeline.css
index 0728e9af5..3fabac31e 100644
--- a/web/css/timeline.css
+++ b/web/css/timeline.css
@@ -702,12 +702,11 @@ button:focus {
bottom: 10px;
background: rgba(40, 40, 40, 0.85);
border: thin solid #333;
- padding: 3px;
border-radius: 5px;
cursor: pointer;
height: 44px;
& .button-action-group {
- height: 37px;
+ height: 44px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
diff --git a/web/js/components/map/rotation.js b/web/js/components/map/rotation.js
index 3f8192380..ecf3ecb53 100644
--- a/web/js/components/map/rotation.js
+++ b/web/js/components/map/rotation.js
@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { debounce } from 'lodash';
import PropTypes from 'prop-types';
import { saveRotation } from '../../map/util';
+import HoverTooltip from '../util/hover-tooltip';
const duration = 500;
@@ -51,7 +52,9 @@ class Rotation extends React.Component {
}
render() {
- const { rotation, proj, isDistractionFreeModeActive } = this.props;
+ const {
+ rotation, proj, isDistractionFreeModeActive, isMobile,
+ } = this.props;
const currentRotation = Number(rotation * (180 / Math.PI)).toFixed();
const isPolarProj = proj.id !== 'geographic' && proj.id !== 'webmerc';
@@ -60,36 +63,51 @@ class Rotation extends React.Component {
<button
type="button"
className="wv-map-rotate-left wv-map-zoom"
- title="You may also rotate by holding Alt and dragging the mouse"
onMouseDown={() => { this.rotateOnClick(10); }}
onMouseUp={this.clearInterval}
onMouseOut={this.clearInterval}
onMouseMove={(e) => { e.stopPropagation(); }}
>
+ <HoverTooltip
+ isMobile={isMobile}
+ labelText="You may also rotate by holding Alt and dragging the mouse"
+ placement="left"
+ target=".wv-map-rotate-left"
+ />
<FontAwesomeIcon icon="undo" className="cursor-pointer" />
</button>
<button
type="button"
className="wv-map-reset-rotation wv-map-zoom"
- title="Reset rotation"
onMouseDown={this.resetRotation}
onMouseUp={this.clearInterval}
onMouseOut={this.clearInterval}
onMouseMove={(e) => { e.stopPropagation(); }}
>
+ <HoverTooltip
+ isMobile={isMobile}
+ labelText="Reset rotation"
+ placement="left"
+ target=".wv-map-reset-rotation"
+ />
{currentRotation}
</button>
<button
type="button"
className="wv-map-rotate-right wv-map-zoom"
- title="You may also rotate by holding Alt and dragging the mouse"
onMouseDown={() => { this.rotateOnClick(-10); }}
onMouseUp={this.clearInterval}
onMouseOut={this.clearInterval}
onMouseMove={(e) => { e.stopPropagation(); }}
>
+ <HoverTooltip
+ isMobile={isMobile}
+ labelText="You may also rotate by holding Alt and dragging the mouse"
+ placement="left"
+ target=".wv-map-rotate-right"
+ />
<FontAwesomeIcon icon="redo" className="cursor-pointer" />
</button>
</div>
@@ -98,12 +116,16 @@ class Rotation extends React.Component {
}
const mapStateToProps = (state) => {
- const { map, proj, ui } = state;
+ const {
+ browser, map, proj, ui,
+ } = state;
+ const isMobile = browser.lessThan.medium;
return {
map,
proj,
rotation: map.rotation,
isDistractionFreeModeActive: ui.isDistractionFreeModeActive,
+ isMobile,
};
};
@@ -120,6 +142,7 @@ Rotation.propTypes = {
map: PropTypes.object,
rotation: PropTypes.number,
isDistractionFreeModeActive: PropTypes.bool,
+ isMobile: PropTypes.bool,
proj: PropTypes.object,
updateRotationState: PropTypes.func,
};
diff --git a/web/js/components/map/zoom.js b/web/js/components/map/zoom.js
index 57e9d166b..7825eb65f 100644
--- a/web/js/components/map/zoom.js
+++ b/web/js/components/map/zoom.js
@@ -3,9 +3,10 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { mapUtilZoomAction } from '../../map/util';
+import HoverTooltip from '../util/hover-tooltip';
function Zoom({
- map, zoomLevel, numZoomLevels, isDistractionFreeModeActive,
+ map, zoomLevel, numZoomLevels, isDistractionFreeModeActive, isMobile,
}) {
if (!map) return null;
@@ -15,10 +16,15 @@ function Zoom({
type="button"
disabled={zoomLevel === numZoomLevels}
className="wv-map-zoom wv-map-zoom-in"
- title="Zoom in view."
onClick={() => { mapUtilZoomAction(map, 1); }}
onMouseMove={(e) => e.stopPropagation()}
>
+ <HoverTooltip
+ isMobile={isMobile}
+ labelText="Zoom in view"
+ placement="left"
+ target=".wv-map-zoom-in"
+ />
<FontAwesomeIcon icon="plus" />
</button>
<button
@@ -29,6 +35,12 @@ function Zoom({
onClick={() => { mapUtilZoomAction(map, -1); }}
onMouseMove={(e) => e.stopPropagation()}
>
+ <HoverTooltip
+ isMobile={isMobile}
+ labelText="Zoom out view"
+ placement="left"
+ target=".wv-map-zoom-out"
+ />
<FontAwesomeIcon icon="minus" />
</button>
</div>
@@ -36,19 +48,24 @@ function Zoom({
}
const mapStateToProps = (state) => {
- const { map, proj, ui } = state;
+ const {
+ browser, map, proj, ui,
+ } = state;
const activeMap = map.ui.selected;
+ const isMobile = browser.lessThan.medium;
return {
map: activeMap,
zoomLevel: activeMap && activeMap.getView().getZoom(),
numZoomLevels: proj.selected.numZoomLevels,
isDistractionFreeModeActive: ui.isDistractionFreeModeActive,
+ isMobile,
};
};
Zoom.propTypes = {
map: PropTypes.object,
isDistractionFreeModeActive: PropTypes.bool,
+ isMobile: PropTypes.bool,
numZoomLevels: PropTypes.number,
zoomLevel: PropTypes.number,
};
diff --git a/web/js/components/timeline/mobile-date-picker.js b/web/js/components/timeline/mobile-date-picker.js
index 5c60dd476..4dbeaa616 100644
--- a/web/js/components/timeline/mobile-date-picker.js
+++ b/web/js/components/timeline/mobile-date-picker.js
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import DatePicker from 'react-mobile-datepicker';
import { getDisplayDate, getISODateFormatted } from './date-util';
import { monthMap } from '../../modules/date/constants';
+import HoverTooltip from '../util/hover-tooltip';
// https://www.npmjs.com/package/react-mobile-datepicker
// configs for date order, caption, and date step
@@ -151,6 +152,7 @@ class MobileDatePicker extends Component {
const {
date,
hasSubdailyLayers,
+ isMobile,
} = this.props;
const displayDate = getDisplayDate(date, hasSubdailyLayers);
@@ -161,6 +163,12 @@ class MobileDatePicker extends Component {
className="mobile-date-picker-select-btn"
onClick={this.handleClickDateButton}
>
+ <HoverTooltip
+ isMobile={isMobile}
+ labelText="Select the date"
+ placement="top"
+ target=".mobile-date-picker-select-btn"
+ />
{displayDate}
</div>
<DatePicker
@@ -188,6 +196,7 @@ MobileDatePicker.propTypes = {
date: PropTypes.string,
endDateLimit: PropTypes.string,
hasSubdailyLayers: PropTypes.bool,
+ isMobile: PropTypes.bool,
onDateChange: PropTypes.func,
startDateLimit: PropTypes.string,
};
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index b2bda9fd9..b0cf34346 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -983,7 +983,7 @@ class Timeline extends React.Component {
let mobileBottom = 10;
if (isEmbedModeActive) {
mobileLeft = 135;
- mobileBottom = 5;
+ mobileBottom = 4;
}
// positioning will change depending on a combination of:
// 1) subdaily (mobile date picker width);
@@ -1112,6 +1112,7 @@ class Timeline extends React.Component {
endDateLimit={timelineEndDateLimit}
onDateChange={this.onDateChange}
hasSubdailyLayers={hasSubdailyLayers}
+ isMobile={isMobile}
/>
<MobileComparisonToggle />
<div