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:
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',
)

View File

@ -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());
}

View File

@ -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`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -88,7 +88,7 @@
<textarea id="id_multipolygon" name="multipolygon" class="vSerializedField required"
style="display:none;" rows="10" cols="150"></textarea>
</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='./gis/mapwidget.test.js'></script>