Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update zoom correctly when requesting link to this configuration #2488

Merged
merged 1 commit into from Nov 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions python/nav/web/static/js/geomap/GeomapPlugin.js
Expand Up @@ -135,6 +135,22 @@ function(Spinner, fullscreen) {
var requestedBounds = OpenLayers.Bounds.fromArray(parameters.bbox);
requestedBounds.transform(map.displayProjection, map.getProjectionObject());
map.zoomToExtent(requestedBounds);
} else if (parameters.zoom !== null && parameters.zoom !== undefined) {
try {
if (parameters.lat !== null && parameters.lat !== undefined
&& parameters.lon !== null && parameters.lon !== undefined) {
map.setView(
new OpenLayers.View({
center: OpenLayers.Projection.fromLonLat([parameters.lon, parameters.lat]),
extent: map.getView().calculateExtent(map.getSize()),
zoom: parameters.zoom
})
);
} else {
map.getView.setZoom(parameters.zoom);
}
map.getView.setZoom(parameters.zoom);
} catch (e) {}
} else if (boundingBox) {
boundingBox.transform(map.displayProjection, map.getProjectionObject());
map.zoomToExtent(boundingBox);
Expand Down