diff --git a/django/contrib/gis/forms/widgets.py b/django/contrib/gis/forms/widgets.py
index cd9bff9f68..611bed9f6d 100644
--- a/django/contrib/gis/forms/widgets.py
+++ b/django/contrib/gis/forms/widgets.py
@@ -80,12 +80,12 @@ class OpenLayersWidget(BaseGeometryWidget):
class Media:
css = {
'all': (
- 'https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.css',
+ 'https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.5/ol.css',
'gis/css/ol3.css',
)
}
js = (
- 'https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.js',
+ 'https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.5/ol.js',
'gis/js/OLMapWidget.js',
)
diff --git a/django/contrib/gis/static/gis/js/OLMapWidget.js b/django/contrib/gis/static/gis/js/OLMapWidget.js
index 4cd98e2f1a..52864ed9ba 100644
--- a/django/contrib/gis/static/gis/js/OLMapWidget.js
+++ b/django/contrib/gis/static/gis/js/OLMapWidget.js
@@ -102,7 +102,7 @@ ol.inherits(GeometryTypeControl, ol.control.Control);
ol.extent.extend(extent, feature.getGeometry().getExtent());
}, this);
// Center/zoom the map
- this.map.getView().fit(extent, this.map.getSize(), {maxZoom: this.options.default_zoom});
+ this.map.getView().fit(extent, {maxZoom: this.options.default_zoom});
} else {
this.map.getView().setCenter(this.defaultCenter());
}
diff --git a/docs/releases/2.1.txt b/docs/releases/2.1.txt
index 3152a42d76..101d42ee03 100644
--- a/docs/releases/2.1.txt
+++ b/docs/releases/2.1.txt
@@ -94,6 +94,9 @@ Minor features
:meth:`~.GEOSGeometry.buffer` that allows customizing the style of the
buffer.
+* :class:`~django.contrib.gis.forms.widgets.OpenLayersWidget` is now based on
+ OpenLayers 4.6.5 (previously 3.20.1).
+
:mod:`django.contrib.messages`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/js_tests/tests.html b/js_tests/tests.html
index d2a361ad75..7c6ba34977 100644
--- a/js_tests/tests.html
+++ b/js_tests/tests.html
@@ -88,7 +88,7 @@
-
+