Interactive interface for browsing global, full-resolution satellite imagery
add shift d distraction free shortcut, prevent ctrl cmd key interaction, add keypress action and refine manual version wip
Edward Platob5dc27d766ea
diff --git a/web/js/app.js b/web/js/app.jsindex f4ed8fd62..ce2899f66 100644--- a/web/js/app.js+++ b/web/js/app.js@@ -88,7 +88,8 @@ class App extends React.Component {}handleKeyPress(event) {- this.props.keyPressAction(event.keyCode);+ const ctrlOrCmdKey = event.ctrlKey || event.metaKey;+ this.props.keyPressAction(event.keyCode, event.shiftKey, ctrlOrCmdKey);}componentDidMount() {@@ -187,8 +188,8 @@ function mapStateToProps(state, ownProps) {};}const mapDispatchToProps = dispatch => ({- keyPressAction: keyCode => {- dispatch(keyPress(keyCode));+ keyPressAction: (keyCode, shiftKey, ctrlOrCmdKey) => {+ dispatch(keyPress(keyCode, shiftKey, ctrlOrCmdKey));},screenResize: (width, height) => {dispatch(calculateResponsiveState(window));diff --git a/web/js/components/map/ol-coordinates.js b/web/js/components/map/ol-coordinates.jsindex de2df5d5a..ca94dca4f 100644--- a/web/js/components/map/ol-coordinates.js+++ b/web/js/components/map/ol-coordinates.js@@ -78,11 +78,7 @@ class OlCoordinates extends React.Component {}return (-<<<<<<< HEAD- <div style={{ display: this.props.isDistractionFreeModeActive ? 'none' : 'block' }}>-=======- <div id='ol-coords-case'>->>>>>>> 28e21d4e34e20f0d482a19167d6163b9066d85f7+ <div id='ol-coords-case' style={{ display: this.props.isDistractionFreeModeActive ? 'none' : 'block' }}><Coordinatesformat={this.state.format}latitude={this.state.latitude}diff --git a/web/js/map/ui.js b/web/js/map/ui.jsindex 600cb576d..8e129a9f2 100644--- a/web/js/map/ui.js+++ b/web/js/map/ui.js@@ -101,7 +101,8 @@ export function mapui(models, config, store, ui) {switch (action.type) {case TOGGLE_DISTRACTION_FREE_MODE: {var map = self.selected;- if (action.isDistractionFreeModeActive) {+ const isDistractionFreeModeActive = store.getState().ui.isDistractionFreeModeActive;+ if (isDistractionFreeModeActive) {// hide map scale and zoom buttonsmap.removeControl(map.wv.scaleImperial);map.removeControl(map.wv.scaleMetric);diff --git a/web/js/modules/key-press/actions.js b/web/js/modules/key-press/actions.jsindex 8ea047247..eb7785061 100644--- a/web/js/modules/key-press/actions.js+++ b/web/js/modules/key-press/actions.js@@ -1,5 +1,7 @@import { KEY_PRESS_ACTION as ANIMATION_KEY_PRESS_ACTION } from '../animation/constants';import { TOUR_KEY_PRESS_CLOSE } from '../tour/constants';+import { TOGGLE_DISTRACTION_FREE_MODE } from '../ui/constants';+import { CLOSE as CLOSE_MODAL } from '../modal/constants';/*** Function to dispatch actions@@ -7,11 +9,13 @@ import { TOUR_KEY_PRESS_CLOSE } from '../tour/constants';* State** @param {Number} keyCode+ * @param {Boolean} is shiftKey down*/-export function keyPress(keyCode) {+export function keyPress(keyCode, shiftKey, ctrlOrCmdKey) {return (dispatch, getState) => {- const { modal, animation, tour } = getState();- if (animation.isActive && !modal.isOpen) {+ const { modal, animation, tour, ui } = getState();+ const modalIsOpen = modal.isOpen;+ if (animation.isActive && !modalIsOpen) {// can get more specific modal.key !== "LAYER_PICKER_COMPONENT"dispatch({type: ANIMATION_KEY_PRESS_ACTION,@@ -23,5 +27,12 @@ export function keyPress(keyCode) {type: TOUR_KEY_PRESS_CLOSE});}+ if (!ctrlOrCmdKey && shiftKey && keyCode === 68) {+ const isDistractionFreeModeActive = ui.isDistractionFreeModeActive;+ dispatch({ type: TOGGLE_DISTRACTION_FREE_MODE });+ if (!isDistractionFreeModeActive && modalIsOpen) {+ dispatch({ type: CLOSE_MODAL });+ }+ }};}diff --git a/web/js/modules/ui/actions.js b/web/js/modules/ui/actions.jsindex 1a6bc1e3e..e0ed54ff3 100644--- a/web/js/modules/ui/actions.js+++ b/web/js/modules/ui/actions.js@@ -1,11 +1,17 @@import { TOGGLE_DISTRACTION_FREE_MODE } from './constants';+import { CLOSE as CLOSE_MODAL } from '../modal/constants';export function toggleDistractionFreeMode() {return (dispatch, getState) => {- const newisDistractionFreeModeActive = getState().ui.isDistractionFreeModeActive;+ const { modal, ui } = getState();+ const isDistractionFreeModeActive = ui.isDistractionFreeModeActive;+ const modalIsOpen = modal.isOpen;dispatch({type: TOGGLE_DISTRACTION_FREE_MODE,- isDistractionFreeModeActive: !newisDistractionFreeModeActive+ isDistractionFreeModeActive: !isDistractionFreeModeActive});+ if (!isDistractionFreeModeActive && modalIsOpen) {+ dispatch({ type: CLOSE_MODAL });+ }};}