From 1e20fedb352dde5db2657cad73f998ccdb1aa607 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 22 Dec 2017 16:58:32 +0100 Subject: [PATCH] Upgraded OpenLayers to 4.6.5 for OpenLayersWidget --- django/contrib/gis/forms/widgets.py | 4 ++-- django/contrib/gis/static/gis/js/OLMapWidget.js | 2 +- docs/releases/2.1.txt | 3 +++ js_tests/tests.html | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/forms/widgets.py b/django/contrib/gis/forms/widgets.py index cd9bff9f68c..611bed9f6de 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 4cd98e2f1aa..52864ed9ba3 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 3152a42d76e..101d42ee037 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 d2a361ad751..7c6ba349771 100644 --- a/js_tests/tests.html +++ b/js_tests/tests.html @@ -88,7 +88,7 @@ - +