Skip to content

Commit

Permalink
Fixes #287 - Upgrade proj4js to 2.6.1 and Proj4Leaflet to 1.0.2 (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed May 18, 2020
1 parent a957a34 commit 139bae6
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 184 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -6,6 +6,7 @@ CHANGELOG
-------------------

- Drop support for Django < 1.11
- Upgrade proj4js to 2.6.1 and Proj4Leaflet to 1.0.2 (#287)
- Update Czech translations, add Slovak translations #269
- Add Arabic translation #274

Expand Down
2 changes: 1 addition & 1 deletion leaflet/__init__.py
Expand Up @@ -128,7 +128,7 @@
'leaflet/leaflet.extras.js',
'leaflet/leaflet.forms.js']
if SRID:
_forms_js += ['leaflet/proj4js.js',
_forms_js += ['leaflet/proj4.js',
'leaflet/proj4leaflet.js',
'proj4js/%s.js' % SRID]

Expand Down
2 changes: 1 addition & 1 deletion leaflet/static/leaflet/leaflet.extras.js
Expand Up @@ -86,7 +86,7 @@ L.Map.DjangoMap = L.Map.extend({
resolutions.push(maxResolution / Math.pow(2, z));
}
var crs = new L.Proj.CRS('EPSG:' + djoptions.srid,
Proj4js.defs['EPSG:' + djoptions.srid],
proj4.defs['EPSG:' + djoptions.srid],
{
origin: [bbox[0], bbox[3]],
resolutions: resolutions
Expand Down
1 change: 1 addition & 0 deletions leaflet/static/leaflet/proj4.js

Large diffs are not rendered by default.

180 changes: 0 additions & 180 deletions leaflet/static/leaflet/proj4js.js

This file was deleted.

11 changes: 10 additions & 1 deletion leaflet/static/leaflet/proj4leaflet.js
Expand Up @@ -15,7 +15,13 @@
factory(window.L, window.proj4);
}
}(function (L, proj4) {

if (proj4.__esModule && proj4.default) {
// If proj4 was bundled as an ES6 module, unwrap it to get
// to the actual main proj4 object.
// See discussion in https://github.com/kartena/Proj4Leaflet/pull/147
proj4 = proj4.default;
}

L.Proj = {};

L.Proj._isProj4Obj = function(a) {
Expand Down Expand Up @@ -137,6 +143,9 @@
if (scale === downScale) {
return downZoom;
}
if (downScale === undefined) {
return -Infinity;
}
// Interpolate
nextZoom = downZoom + 1;
nextScale = this._scales[nextZoom];
Expand Down
2 changes: 1 addition & 1 deletion leaflet/templates/leaflet/js.html
Expand Up @@ -6,7 +6,7 @@
<script src="{% static "leaflet/leaflet.js" %}"></script>
{% endif %}
{% if SRID %}
<script src="{% static "leaflet/proj4js.js" %}"></script>
<script src="{% static "leaflet/proj4.js" %}"></script>
<script src="{% static "leaflet/proj4leaflet.js" %}"></script>
<script src="{% static "proj4js/"|add:SRID|add:".js" %}"></script>
{% endif %}
Expand Down

0 comments on commit 139bae6

Please sign in to comment.