Interactive interface for browsing global, full-resolution satellite imagery
remove debounce causing event fire issue, revise dateline to prevent unecessary updates
Ed Plato5ce17b4eda8b
diff --git a/web/js/components/dateline/dateline.js b/web/js/components/dateline/dateline.jsindex feb4a701e..0ff7154ba 100644--- a/web/js/components/dateline/dateline.js+++ b/web/js/components/dateline/dateline.js@@ -16,17 +16,29 @@ class Line extends React.Component {super(props);this.state = {hovered: false,- height: props.height,+ height: 0,active: true,};}+ shouldComponentUpdate(nextProps, nextState) {+ const { active, height, hovered } = this.state;+ const checkForStateUpdates = nextState.active === active+ && nextState.height === height+ && nextState.hovered === hovered;++ if (checkForStateUpdates) {+ return false;+ }+ return true;+ }+/** Updates state on svg hover** return {Void}*/- mouseOver() {+ mouseOver = () => {this.setState({hovered: true,});@@ -37,7 +49,7 @@ class Line extends React.Component {** return {Void}*/- mouseOut() {+ mouseOut = () => {this.setState({hovered: false,});@@ -51,7 +63,7 @@ class Line extends React.Component {* @param {Object} e - React event object* return {Void}*/- mouseOverHidden(e) {+ mouseOverHidden = (e) => {const {lineOver, overlay, lineX, tooltip,} = this.props;@@ -70,7 +82,7 @@ class Line extends React.Component {** return {Void}*/- mouseOutHidden() {+ mouseOutHidden = () => {const { lineOut, tooltip } = this.props;lineOut(tooltip);}@@ -90,8 +102,8 @@ class Line extends React.Component {const { height, active, hovered } = this.state;return (<svg- onMouseOver={this.mouseOver.bind(this)}- onMouseOut={this.mouseOut.bind(this)}+ onMouseOver={this.mouseOver}+ onMouseOut={this.mouseOut}style={svgStyle}width={width}id={id}@@ -115,9 +127,9 @@ class Line extends React.Component {/><lineclassName="dateline-hidden"- onMouseOver={this.mouseOverHidden.bind(this)}- onMouseMove={this.mouseOverHidden.bind(this)}- onMouseOut={this.mouseOutHidden.bind(this)}+ onMouseOver={this.mouseOverHidden}+ onMouseMove={this.mouseOverHidden}+ onMouseOut={this.mouseOutHidden}style={style}opacity="0"x1={strokeWidth / 2}@@ -137,7 +149,6 @@ Line.defaultProps = {width: '10',strokeWidth: '6',color: 'white',- height: 200,svgStyle: {margin: '0 40px 0 40px',transform: 'translateX(-43px)',@@ -148,7 +159,6 @@ Line.propTypes = {classes: PropTypes.string,color: PropTypes.string,dashArray: PropTypes.string,- height: PropTypes.number,id: PropTypes.string,lineOut: PropTypes.func,lineOver: PropTypes.func,diff --git a/web/js/map/datelinebuilder.js b/web/js/map/datelinebuilder.jsindex a83264294..e2652ef41 100644--- a/web/js/map/datelinebuilder.js+++ b/web/js/map/datelinebuilder.js@@ -2,7 +2,6 @@import React from 'react';import ReactDOM from 'react-dom';import OlOverlay from 'ol/Overlay';-import util from '../util/util';import DateLine from '../components/dateline/dateline';import LineText from '../components/dateline/text';diff --git a/web/js/map/ui.js b/web/js/map/ui.jsindex 5e3f47b71..b6b0758bb 100644--- a/web/js/map/ui.js+++ b/web/js/map/ui.js@@ -77,7 +77,6 @@ export default function mapui(models, config, store, ui) {self.mapIsbeingDragged = false;self.mapIsbeingZoomed = false;self.proj = {}; // One map for each projection- self.zoomButtonListeners = []; // Track debounced zoom button listenersself.selected = null; // The map for the selected projectionself.events = util.events();const layerBuilder = self.layerBuilder = mapLayerBuilder(@@ -933,20 +932,6 @@ export default function mapui(models, config, store, ui) {});$zoomIn.mousemove((e) => e.stopPropagation());- /*- * Debounce for below onZoomChange function- *- * @funct debouncedZoomChange- * @static- *- * @returns {void}- *- */- const debouncedZoomChange = () => {- onZoomChange();- self.events.trigger('movestart');- };-/** Sets zoom buttons as active or inactive based* on the zoom level@@ -971,7 +956,10 @@ export default function mapui(models, config, store, ui) {$zoomOut.button('enable');}};- map.getView().on('change:resolution', lodashDebounce(debouncedZoomChange, 30));+ map.getView().on('change:resolution', () => {+ onZoomChange();+ self.events.trigger('movestart');+ });onZoomChange();}/*