Interactive interface for browsing global, full-resolution satellite imagery
Add layer icon additions #2884
Benjamin Kingaa40277a6fcc
diff --git a/web/css/sidebar-panel.css b/web/css/sidebar-panel.cssindex 46bbf277a..d843354d5 100644--- a/web/css/sidebar-panel.css+++ b/web/css/sidebar-panel.css@@ -284,10 +284,16 @@ li.item.productsitem.inmotion,.productsitem .layer-pointer-icon svg.svg-inline--fa {color: #22a;}+.productsitem .layer-pointer-icon.disabled svg.svg-inline--fa {+ color: #333333;+}.productsitem .layer-pointer-icon:hover svg.svg-inline--fa {- transform: scale(1.2);cursor: pointer;}+.productsitem .layer-pointer-icon.running svg.svg-inline--fa,+.productsitem .layer-pointer-icon:hover svg.svg-inline--fa {+ transform: scale(1.2);+}.layer-hidden svg.svg-inline--fa {color: #c5c5c8;}@@ -295,6 +301,30 @@ li.item.productsitem.inmotion,color: #000;}+.layer-pointer-icon.disabled:before, .layer-pointer-icon.disabled:after {+ position: absolute;+ content: '';+ background: red;+ display: block;+ width: 1px;+ height: 19px;+ left: 0;+ right: 0;+ top: 0;+ bottom: 0;+ margin: auto;+ cursor: pointer;+}++.layer-pointer-icon.disabled:before {+ -webkit-transform: rotate(-45deg);+ transform: rotate(-45deg);+}++.layer-pointer-icon.disabled:after {+ -webkit-transform: rotate(45deg);+ transform: rotate(45deg);+}.productsitem a.wv-layers-info,.productsitem a.wv-layers-options {position: relative;diff --git a/web/images/vector-alert.png b/web/images/vector-alert.pngindex 73e0cc5e0..1e689b172 100644Binary files a/web/images/vector-alert.png and b/web/images/vector-alert.png differdiff --git a/web/js/components/layer/vector/alert.js b/web/js/components/layer/vector/alert.jsindex 50569b6d0..b5f3fcf2c 100644--- a/web/js/components/layer/vector/alert.js+++ b/web/js/components/layer/vector/alert.js@@ -6,18 +6,37 @@ const VectorAlertModalBody = () => (<Container className="event-alert-modal-body"><Row className="p-2"><h2>- Why can’t I click on a feature in a vector layer?+ What are vector layers and how do they differ from raster(image) layers?</h2></Row>+ <Row className="p-3">+ <p>+ Vector layers are layers that have sets of information associated with each + pixel. Raster layers provide tiled PNGs or JPEGs that only have color values associated with each pixel.+ </p>+ </Row><Row className="p-2">+ <h2>+ Why can’t I click on a feature in a vector layer?+ </h2>+ </Row>+ <Row className="p-3"><p>- Some vector layers are rendered as raster images in outer zoom levels to enhance visibility+ Some vector layers that have a vast number of features are + rendered as raster images in outer zoom levels to enhance the + speed of map interactions (dragging and zooming) these+ layers are render.</p></Row><Row className="p-2">+ <h2>+ How can I determine which layers have clickable features?+ </h2>+ </Row>+ <Row className="p-3"><Col><p>- If you see the pointer icon next to the layer, you should be able to click on the layer's features to access feature metadata.+ If you see the pointer icon next to the layer, you should be able to click on that layer's features in order to access metadata associated with that feature.</p></Col><Col>diff --git a/web/js/containers/alerts.js b/web/js/containers/alerts.jsindex 91ddc49a6..0e1faff66 100644--- a/web/js/containers/alerts.js+++ b/web/js/containers/alerts.js@@ -3,49 +3,12 @@ import React from 'react';import { connect } from 'react-redux';import PropTypes from 'prop-types';import AlertUtil from '../components/util/alert';-import EventsAlertModalBody from '../components/events/alert-body';-import CompareAlertModalBody from '../components/compare/alert';-import VectorAlertModalBody from '../components/layer/vector/alert';import { openCustomContent } from '../modules/modal/actions';import util from '../util/util';import { hasVectorLayers } from '../modules/layers/util';-import { DISABLE_VECTOR_ALERT } from '../modules/alerts/constants';+import { DISABLE_VECTOR_ALERT, MODAL_PROPERTIES } from '../modules/alerts/constants';+-const MODAL_PROPERTIES = {- eventModalProps: {- id: 'event_visibility_info',- props: {- headerText: 'Events may not be visible at all times.',- backdrop: false,- size: 'lg',- clickableBehindModal: true,- bodyComponent: EventsAlertModalBody,- desktopOnly: true,- },- },- compareModalProps: {- id: 'compare_mode_info',- props: {- headerText: 'You are now in comparison mode',- backdrop: false,- size: 'lg',- clickableBehindModal: true,- bodyComponent: CompareAlertModalBody,- desktopOnly: true,- },- },- vectorModalProps: {- id: 'vector_layer_info',- props: {- headerText: 'Vector features may not be clickable at all times.',- backdrop: false,- size: 'lg',- clickableBehindModal: true,- bodyComponent: VectorAlertModalBody,- desktopOnly: true,- },- },-};const HAS_LOCAL_STORAGE = util.browser.localStorage;class DismissableAlerts extends React.Component {constructor(props) {diff --git a/web/js/containers/sidebar/layer.js b/web/js/containers/sidebar/layer.jsindex 09b90a672..aede83b80 100644--- a/web/js/containers/sidebar/layer.js+++ b/web/js/containers/sidebar/layer.js@@ -15,7 +15,7 @@ import {getPalette,getPaletteLegends,} from '../../modules/palettes/selectors';-import { toggleCustomContent } from '../../modules/modal/actions';+import { toggleCustomContent, openCustomContent } from '../../modules/modal/actions';import LayerInfo from '../../components/layer/info/info';import LayerSettings from '../../components/layer/settings/settings';import { requestPalette } from '../../modules/palettes/actions';@@ -26,7 +26,9 @@ import {} from '../../modules/layers/actions';import OrbitTrack from './orbit-track';import { isVectorLayerClickable } from '../../modules/layers/util';+import { MODAL_PROPERTIES } from '../../modules/alerts/constants';+const { vectorModalProps } = MODAL_PROPERTIES;const visibilityButtonClasses = 'hdanchor hide hideReg bank-item-img';const getItemStyle = (isDragging, draggableStyle) => ({@@ -147,6 +149,28 @@ class Layer extends React.Component {);}+ renderVectorIcon() {+ const {+ isVectorLayer, hasClickableFeature, openVectorAlertModal, runningObject,+ } = this.props;+ const clasNames = hasClickableFeature+ ? 'layer-pointer-icon'+ : 'layer-pointer-icon disabled';+ const title = hasClickableFeature+ ? 'You can click the features of this layer to see metadata associated with the feature.'+ : 'Zoom in further to click features.';+ return isVectorLayer ? (+ <div className={runningObject ? `${clasNames} running` : clasNames} onClick={openVectorAlertModal}>+ {' '}+ <FontAwesomeIcon+ title={title}+ icon={faMousePointer}+ fixedWidth+ />+ </div>+ ) : null;+ }+render() {const {layerGroupName,@@ -162,7 +186,6 @@ class Layer extends React.Component {zot,isInProjection,tracksForLayer,- hasClickableFeature,} = this.props;const containerClass = isDisabled@@ -235,16 +258,7 @@ class Layer extends React.Component {<p dangerouslySetInnerHTML={{ __html: names.subtitle }} />{hasPalette ? this.getPaletteLegend() : ''}</div>- {hasClickableFeature ? (- <div className="layer-pointer-icon">- {' '}- <FontAwesomeIcon- title="You can click the features of this layer to see metadata associated with the feature"- icon={faMousePointer}- fixedWidth- />- </div>- ) : null}+ {this.renderVectorIcon()}{tracksForLayer.length > 0 && (<div className="layer-tracks">{tracksForLayer.map((track) => (@@ -274,36 +288,7 @@ class Layer extends React.Component {Layer.defaultProps = {palette: {},};-Layer.propTypes = {- checkerBoardPattern: PropTypes.object,- compare: PropTypes.object,- getPalette: PropTypes.func,- hasPalette: PropTypes.bool,- hover: PropTypes.func,- index: PropTypes.number,- isCustomPalette: PropTypes.bool,- isDisabled: PropTypes.bool,- isInProjection: PropTypes.bool,- isLoading: PropTypes.bool,- isMobile: PropTypes.bool,- isVisible: PropTypes.bool,- layer: PropTypes.object,- layerClasses: PropTypes.string,- layerGroupName: PropTypes.string,- names: PropTypes.object,- onInfoClick: PropTypes.func,- onOptionsClick: PropTypes.func,- onRemoveClick: PropTypes.func,- palette: PropTypes.object,- paletteLegends: PropTypes.array,- renderedPalette: PropTypes.object,- requestPalette: PropTypes.func,- runningObject: PropTypes.object,- toggleVisibility: PropTypes.func,- hasClickableFeature: PropTypes.bool,- tracksForLayer: PropTypes.array,- zot: PropTypes.number,-};+function mapStateToProps(state, ownProps) {const {layer,@@ -343,6 +328,7 @@ function mapStateToProps(state, ownProps) {isLoading: palettes.isLoading[paletteName],renderedPalette: renderedPalettes[paletteName],layerGroupName,+ isVectorLayer: isVector,hasClickableFeature: isVector && isVisible && isVectorLayerClickable(layer, mapRes),isMobile: state.browser.lessThan.medium,hasPalette,@@ -358,6 +344,10 @@ const mapDispatchToProps = (dispatch) => ({toggleVisibility: (id, isVisible) => {dispatch(toggleVisibility(id, isVisible));},+ openVectorAlertModal: () => {+ const { id, props } = vectorModalProps;+ dispatch(openCustomContent(id, props));+ },onRemoveClick: (id) => {dispatch(removeLayer(id));},@@ -412,3 +402,35 @@ export default connect(mapStateToProps,mapDispatchToProps,)(Layer);+Layer.propTypes = {+ checkerBoardPattern: PropTypes.object,+ compare: PropTypes.object,+ getPalette: PropTypes.func,+ hasPalette: PropTypes.bool,+ hover: PropTypes.func,+ index: PropTypes.number,+ isCustomPalette: PropTypes.bool,+ isDisabled: PropTypes.bool,+ isInProjection: PropTypes.bool,+ isLoading: PropTypes.bool,+ isMobile: PropTypes.bool,+ isVisible: PropTypes.bool,+ layer: PropTypes.object,+ layerClasses: PropTypes.string,+ layerGroupName: PropTypes.string,+ names: PropTypes.object,+ onInfoClick: PropTypes.func,+ onOptionsClick: PropTypes.func,+ onRemoveClick: PropTypes.func,+ palette: PropTypes.object,+ paletteLegends: PropTypes.array,+ renderedPalette: PropTypes.object,+ requestPalette: PropTypes.func,+ runningObject: PropTypes.object,+ toggleVisibility: PropTypes.func,+ hasClickableFeature: PropTypes.bool,+ tracksForLayer: PropTypes.array,+ openVectorAlertModal: PropTypes.func,+ zot: PropTypes.number,+ isVectorLayer: PropTypes.bool,+};diff --git a/web/js/fixtures.js b/web/js/fixtures.jsindex 7a1e30500..600aefc88 100644--- a/web/js/fixtures.js+++ b/web/js/fixtures.js@@ -4,6 +4,7 @@ import { initialState as initialLayerState } from './modules/layers/reducers';import { initialCompareState } from './modules/compare/reducers';import { getInitialState as getInitialDateState } from './modules/date/reducers';import { defaultState as initialAnimationState } from './modules/animation/reducers';+import { defaultAlertState } from './modules/alerts/reducer';const fixtures = {red: 'ff0000ff',@@ -20,6 +21,7 @@ fixtures.getState = function() {compare: initialCompareState,config: fixtures.config(),layers: initialLayerState,+ alerts: defaultAlertState,date: getInitialDateState(fixtures.config()),animation: initialAnimationState,palettes: {diff --git a/web/js/modules/alerts/constants.js b/web/js/modules/alerts/constants.jsindex c47e88bab..c1477525e 100644--- a/web/js/modules/alerts/constants.js+++ b/web/js/modules/alerts/constants.js@@ -1,3 +1,43 @@+import EventsAlertModalBody from '../../components/events/alert-body';+import CompareAlertModalBody from '../../components/compare/alert';+import VectorAlertModalBody from '../../components/layer/vector/alert';+export const TOGGLE_VECTOR_ALERT = 'ALERTS/TOGGLE_VECTOR_ALERT';export const DISABLE_VECTOR_ALERT = 'ALERTS/DISABLE_VECTOR_ALERT';export const ACTIVATE_VECTOR_ALERT = 'ALERTS/ACTIVATE_VECTOR_ALERT';++export const MODAL_PROPERTIES = {+ eventModalProps: {+ id: 'event_visibility_info',+ props: {+ headerText: 'Events may not be visible at all times.',+ backdrop: false,+ size: 'lg',+ clickableBehindModal: true,+ bodyComponent: EventsAlertModalBody,+ desktopOnly: true,+ },+ },+ compareModalProps: {+ id: 'compare_mode_info',+ props: {+ headerText: 'You are now in comparison mode',+ backdrop: false,+ size: 'lg',+ clickableBehindModal: true,+ bodyComponent: CompareAlertModalBody,+ desktopOnly: true,+ },+ },+ vectorModalProps: {+ id: 'vector_layer_info',+ props: {+ headerText: 'Vector features may not be clickable at all times.',+ backdrop: false,+ size: 'lg',+ clickableBehindModal: true,+ bodyComponent: VectorAlertModalBody,+ desktopOnly: true,+ },+ },+};diff --git a/web/js/modules/layers/actions.js b/web/js/modules/layers/actions.jsindex a3bfa5a13..2f3d59cfe 100644--- a/web/js/modules/layers/actions.js+++ b/web/js/modules/layers/actions.js@@ -147,9 +147,6 @@ export function removeLayer(id) {if (def.product && def.product === data.selectedProduct) {dispatch(selectProduct('')); // Clear selected Data product}- if (alerts.isVectorAlertActive) {- // dispatch({ type: DISABLE_VECTOR_ALERT });- }dispatch({type: REMOVE_LAYER,id,diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.jsindex b24630037..7ecbf4f47 100644--- a/web/js/modules/vector-styles/selectors.js+++ b/web/js/modules/vector-styles/selectors.js@@ -258,4 +258,4 @@ export const applyStyle = (def, olVectorLayer, state, options) => {}setStyleFunction(def, vectorStyleId, vectorStyles, olVectorLayer, state);}-};\ No newline at end of file+};