-
Notifications
You must be signed in to change notification settings - Fork 3
/
leaflet.drupal.js.patch
58 lines (53 loc) · 2.01 KB
/
leaflet.drupal.js.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff --git a/sites/all/modules/contrib/leaflet/leaflet.drupal.js b/sites/all/modules/contrib/leaflet/leaflet.drupal.js
index 33d3566..9250833 100644
--- a/sites/all/modules/contrib/leaflet/leaflet.drupal.js
+++ b/sites/all/modules/contrib/leaflet/leaflet.drupal.js
@@ -107,7 +107,7 @@
lFeature = Drupal.leaflet.create_multipoly(feature);
break;
case 'json':
- lFeature = Drupal.leaflet.create_json(feature.json)
+ lFeature = Drupal.leaflet.create_json(feature.json);
break;
}
@@ -147,14 +147,15 @@
// layers served from TileStream need this correction in the y coordinates
// TODO: Need to explore this more and find a more elegant solution
if (layer.type == 'tilestream') {
- map_layer.getTileUrl = function (tilePoint, zoom) {
- var subdomains = this.options.subdomains,
- s = this.options.subdomains[(tilePoint.x + tilePoint.y) % subdomains.length];
-
- return this._url
- .replace('{z}', zoom)
- .replace('{x}', tilePoint.x)
- .replace('{y}', Math.pow(2, zoom) - tilePoint.y - 1);
+ map_layer.getTileUrl = function (tilePoint) {
+ this._adjustTilePoint(tilePoint);
+ var zoom = this._getZoomForUrl();
+ return L.Util.template(this._url, L.Util.extend({
+ s: this._getSubdomain(tilePoint),
+ z: zoom,
+ x: tilePoint.x,
+ y: Math.pow(2, zoom) - tilePoint.y - 1
+ }, this.options));
}
}
return map_layer;
@@ -233,7 +234,11 @@
},
create_json: function(json) {
- lJSON = new L.GeoJSON();
+ lJSON = new L.GeoJSON(json, {
+ onEachFeature: function(feature, layer) {
+ layer.bindPopup(feature.properties.popup);
+ }
+ });
lJSON.on('featureparse', function (e) {
e.layer.bindPopup(e.properties.popup);
@@ -253,7 +258,6 @@
}
});
- lJSON.addGeoJSON(json);
return lJSON;
},