Skip to content

Commit

Permalink
Merge pull request #34 from wen96/master
Browse files Browse the repository at this point in the history
Multimap support
  • Loading branch information
glenrobertson committed Jun 12, 2016
2 parents ec155e2 + d4149f7 commit 36004f2
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions TileLayer.GeoJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,26 @@ L.TileLayer.GeoJSON = L.TileLayer.Ajax.extend({
L.TileLayer.Ajax.prototype._reset.apply(this, arguments);
},

_getUniqueId: function() {
return String(this._leaflet_id || ''); // jshint ignore:line
},

// Remove clip path elements from other earlier zoom levels
_removeOldClipPaths: function () {
for (var clipPathId in this._clipPathRectangles) {
var clipPathZXY = clipPathId.split('_').slice(1);
var zoom = parseInt(clipPathZXY[0], 10);
if (zoom !== this._map.getZoom()) {
var rectangle = this._clipPathRectangles[clipPathId];
this._map.removeLayer(rectangle);
var clipPath = document.getElementById(clipPathId);
if (clipPath !== null) {
clipPath.parentNode.removeChild(clipPath);
var prefix = clipPathId.split('tileClipPath')[0];
if (this._getUniqueId() === prefix) {
var clipPathZXY = clipPathId.split('_').slice(1);
var zoom = parseInt(clipPathZXY[0], 10);
if (zoom !== this._map.getZoom()) {
var rectangle = this._clipPathRectangles[clipPathId];
this._map.removeLayer(rectangle);
var clipPath = document.getElementById(clipPathId);
if (clipPath !== null) {
clipPath.parentNode.removeChild(clipPath);
}
delete this._clipPathRectangles[clipPathId];
}
delete this._clipPathRectangles[clipPathId];
}
}
},
Expand Down Expand Up @@ -123,7 +130,7 @@ L.TileLayer.GeoJSON = L.TileLayer.Ajax.extend({
}

// Create the clipPath for the tile if it doesn't exist
var clipPathId = 'tileClipPath_' + tilePoint.z + '_' + tilePoint.x + '_' + tilePoint.y;
var clipPathId = this._getUniqueId() + 'tileClipPath_' + tilePoint.z + '_' + tilePoint.x + '_' + tilePoint.y;
var clipPath = document.getElementById(clipPathId);
if (clipPath === null) {
clipPath = document.createElementNS(L.Path.SVG_NS, 'clipPath');
Expand Down

0 comments on commit 36004f2

Please sign in to comment.