Interactive interface for browsing global, full-resolution satellite imagery
tweaks to rotation calc and debouncing
Jason Kente0c25b0fe978
diff --git a/web/js/components/map/rotation.js b/web/js/components/map/rotation.jsindex bffbdcb8e..f7639399c 100644--- a/web/js/components/map/rotation.js+++ b/web/js/components/map/rotation.js@@ -18,36 +18,21 @@ class Rotation extends React.Component {this.resetRotation = this.resetRotation.bind(this);}- componentDidUpdate() {- // const { rotatation } = this.props;-- // Clear interval if being reset?- }-clearInterval() {const { intervalId } = this.state;clearInterval(intervalId);}- /**- *- * @param {*} radians- */- rotate(radians) {+ rotate(degrees) {const { map, updateRotationState } = this.props;const mapView = map.ui.selected.getView();const currentDeg = mapView.getRotation() * (180.0 / Math.PI);+ const rotation = mapView.getRotation() - Math.PI / degrees;saveRotation(currentDeg, mapView);- mapView.animate({- rotation: mapView.getRotation() - Math.PI / radians,- duration,- });- updateRotationState(radians);+ mapView.animate({ rotation, duration });+ updateRotationState(rotation);}- /**- * @param {*} radians- */rotateOnClick = (radians) => {const newIntervalId = setInterval(() => {this.rotate(radians);diff --git a/web/js/map/ui.js b/web/js/map/ui.jsindex 8c185c541..27a78ae5e 100644--- a/web/js/map/ui.js+++ b/web/js/map/ui.js@@ -1009,9 +1009,12 @@ export default function mapui(models, config, store, ui) {};// Set event listeners for changes on the map view (when rotated, zoomed, panned)- map.getView().on('change:center', lodashDebounce(updateExtent, 300));- map.getView().on('change:resolution', lodashDebounce(updateExtent, 300));- map.getView().on('change:rotation', lodashThrottle(onRotate, 300));+ const debouncedUpdateExtent = lodashDebounce(updateExtent, 300);+ const debouncedOnRotate = lodashDebounce(onRotate, 300);++ map.getView().on('change:center', debouncedUpdateExtent);+ map.getView().on('change:resolution', debouncedUpdateExtent);+ map.getView().on('change:rotation', debouncedOnRotate);map.on('pointerdrag', () => {self.mapIsbeingDragged = true;