1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Upgraded OpenLayers to 4.6.5 for OpenLayersWidget

This commit is contained in:
Claude Paroz 2017-12-22 16:58:32 +01:00
parent 78912ccd0e
commit 1e20fedb35
4 changed files with 7 additions and 4 deletions

View File

@ -80,12 +80,12 @@ class OpenLayersWidget(BaseGeometryWidget):
class Media: class Media:
css = { css = {
'all': ( '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', 'gis/css/ol3.css',
) )
} }
js = ( 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', 'gis/js/OLMapWidget.js',
) )

View File

@ -102,7 +102,7 @@ ol.inherits(GeometryTypeControl, ol.control.Control);
ol.extent.extend(extent, feature.getGeometry().getExtent()); ol.extent.extend(extent, feature.getGeometry().getExtent());
}, this); }, this);
// Center/zoom the map // 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 { } else {
this.map.getView().setCenter(this.defaultCenter()); this.map.getView().setCenter(this.defaultCenter());
} }

View File

@ -94,6 +94,9 @@ Minor features
:meth:`~.GEOSGeometry.buffer` that allows customizing the style of the :meth:`~.GEOSGeometry.buffer` that allows customizing the style of the
buffer. buffer.
* :class:`~django.contrib.gis.forms.widgets.OpenLayersWidget` is now based on
OpenLayers 4.6.5 (previously 3.20.1).
:mod:`django.contrib.messages` :mod:`django.contrib.messages`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -88,7 +88,7 @@
<textarea id="id_multipolygon" name="multipolygon" class="vSerializedField required" <textarea id="id_multipolygon" name="multipolygon" class="vSerializedField required"
style="display:none;" rows="10" cols="150"></textarea> style="display:none;" rows="10" cols="150"></textarea>
</div> </div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.0/ol.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.5/ol.js'></script>
<script src='../django/contrib/gis/static/gis/js/OLMapWidget.js' data-cover></script> <script src='../django/contrib/gis/static/gis/js/OLMapWidget.js' data-cover></script>
<script src='./gis/mapwidget.test.js'></script> <script src='./gis/mapwidget.test.js'></script>