Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Cleanup. Removed log statements. Made ternary operation more readable.

Stephan Wlodarczykb7d65efdaa00
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 92f3a0848..938dbbea5 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -228,20 +228,17 @@ export function mapui(models, config, store, ui) {
}
self.selected = self.proj[proj.id];
const map = self.selected;
- // const currentRotation = proj.id !== 'geographic' && proj.id !== 'webmerc' ? models.map.rotation : 0;
- // const rotationStart = models.map.rotation;
- const currentRotation = proj.id !== 'geographic' && proj.id !== 'webmerc' ? map.getView().getRotation() : 0;
- const rotationStart = proj.id !== 'geographic' && proj.id !== 'webmerc' ? models.map.rotation : 0;
+ const isProjectionRotatable = proj.id !== 'geographic' && proj.id !== 'webmerc';
- console.log(`cur ${currentRotation}`);
- console.log(`sta ${rotationStart}`);
+ const currentRotation = isProjectionRotatable ? map.getView().getRotation() : 0;
+ const rotationStart = isProjectionRotatable ? models.map.rotation : 0;
store.dispatch({ type: UPDATE_MAP_UI, ui: self, rotation: start ? rotationStart : currentRotation });
reloadLayers();
// Update the rotation buttons if polar projection to display correct value
- if (proj.id !== 'geographic' && proj.id !== 'webmerc') {
+ if (isProjectionRotatable) {
rotation.setResetButton(currentRotation);
}
@@ -250,7 +247,7 @@ export function mapui(models, config, store, ui) {
// using the previous value.
showMap(map);
map.updateSize();
- if (proj.id !== 'geographic' && proj.id !== 'webmerc') {
+ if (isProjectionRotatable) {
rotation.setResetButton(currentRotation);
}
diff --git a/web/js/modules/map/util.js b/web/js/modules/map/util.js
index 97f80688d..d75acb6c7 100644
--- a/web/js/modules/map/util.js
+++ b/web/js/modules/map/util.js
@@ -43,7 +43,6 @@ export function getMapParameterSetup(
const rotation = lodashGet(currentState, 'map.rotation');
if (rotation) {
- console.log('We in here');
const map = currentState.map.ui.selected;
currentItemState = getRotatedExtent(map);
}
@@ -76,6 +75,12 @@ export function getMapParameterSetup(
},
};
}
+
+export function getRotatedExtent(map) {
+ const view = map.getView();
+ return olExtent.getForViewAndSize(view.getCenter(), view.getResolution(), 0, map.getSize());
+}
+
/**
* Determines if an exent object contains valid values.
*
@@ -139,11 +144,6 @@ export function getLeadingExtent(loadtime) {
return [minLon, minLat, maxLon, maxLat];
}
-export function getRotatedExtent(map) {
- const view = map.getView();
- return olExtent.getForViewAndSize(view.getCenter(), view.getResolution(), 0, map.getSize());
-}
-
/**
* Once a layer's group of layers (prev, current, next day) are fulfilled,
* a promise with an array of their fulfilled values is returned.