From 08f30d1b6ac9b7bc05857f88a70277d5ceb27ba1 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 14 Apr 2022 11:50:31 +0200 Subject: [PATCH] Fixed #33637 -- Improved initial zoom level in MapWidget. --- django/contrib/gis/static/gis/js/OLMapWidget.js | 2 +- js_tests/gis/mapwidget.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django/contrib/gis/static/gis/js/OLMapWidget.js b/django/contrib/gis/static/gis/js/OLMapWidget.js index 2395e4d7dd..69dfa71a5b 100644 --- a/django/contrib/gis/static/gis/js/OLMapWidget.js +++ b/django/contrib/gis/static/gis/js/OLMapWidget.js @@ -99,7 +99,7 @@ ol.inherits(GeometryTypeControl, ol.control.Control); ol.extent.extend(extent, feature.getGeometry().getExtent()); }, this); // Center/zoom the map - this.map.getView().fit(extent, {maxZoom: this.options.default_zoom}); + this.map.getView().fit(extent, {minResolution: 1}); } else { this.map.getView().setCenter(this.defaultCenter()); } diff --git a/js_tests/gis/mapwidget.test.js b/js_tests/gis/mapwidget.test.js index 80ed17b9d0..8991738c6c 100644 --- a/js_tests/gis/mapwidget.test.js +++ b/js_tests/gis/mapwidget.test.js @@ -33,7 +33,7 @@ QUnit.test('MapWidget.defaultCenter', function(assert) { '6.81,47.08', 'Default center at 6.81, 47.08' ); - assert.equal(widget.map.getView().getZoom(), 12); + assert.equal(widget.map.getView().getZoom(), 17); }); QUnit.test('MapWidget.interactions', function(assert) {