Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Resolves zoom issue when reloading the page on rotated artic/antarctic projection.

Stephan Wlodarczykceae155444a2
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index d62b9b9c7..935bfe16e 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -264,10 +264,21 @@ export function mapui(models, config, store, ui) {
};
}
if (extent) {
- map.getView().fit(extent, {
+ const view = map.getView();
+ const mapRotation = view.getRotation();
+
+ // Fit the layer extent to the given size of the map
+ view.fit(extent, {
constrainResolution: false,
callback,
});
+
+ // Correct the zoom level if map was rotated
+ if (mapRotation) {
+ let zoom = Math.round(view.getZoom());
+ if (zoom >= 0) zoom += 1;
+ view.setZoom(zoom);
+ }
}
}
updateExtent();