Compare commits
5 Commits
carto
...
cartodb_le
Author | SHA1 | Date | |
---|---|---|---|
|
90b7e3ae1f | ||
|
af41656a51 | ||
|
594669b261 | ||
|
ca0864ef3e | ||
|
664b47b06d |
76
dist/leaflet-src.js
vendored
76
dist/leaflet-src.js
vendored
@ -406,7 +406,6 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
|
|||||||
|
|
||||||
var ie = !!window.ActiveXObject,
|
var ie = !!window.ActiveXObject,
|
||||||
ie6 = ie && !window.XMLHttpRequest,
|
ie6 = ie && !window.XMLHttpRequest,
|
||||||
ie7 = ie && !document.querySelector,
|
|
||||||
|
|
||||||
// terrible browser detection to work around Safari / iOS / Android browser bugs
|
// terrible browser detection to work around Safari / iOS / Android browser bugs
|
||||||
ua = navigator.userAgent.toLowerCase(),
|
ua = navigator.userAgent.toLowerCase(),
|
||||||
@ -414,6 +413,8 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
|
|||||||
chrome = ua.indexOf('chrome') !== -1,
|
chrome = ua.indexOf('chrome') !== -1,
|
||||||
android = ua.indexOf('android') !== -1,
|
android = ua.indexOf('android') !== -1,
|
||||||
android23 = ua.search('android [23]') !== -1,
|
android23 = ua.search('android [23]') !== -1,
|
||||||
|
ie7 = ie && !document.querySelector && ua.search('msie 7') !== -1,
|
||||||
|
ie8 = ie && ua.search('msie 8') !== -1,
|
||||||
|
|
||||||
mobile = typeof orientation !== undefined + '',
|
mobile = typeof orientation !== undefined + '',
|
||||||
msTouch = window.navigator && window.navigator.msPointerEnabled &&
|
msTouch = window.navigator && window.navigator.msPointerEnabled &&
|
||||||
@ -463,6 +464,7 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
|
|||||||
ie: ie,
|
ie: ie,
|
||||||
ie6: ie6,
|
ie6: ie6,
|
||||||
ie7: ie7,
|
ie7: ie7,
|
||||||
|
ie8: ie8,
|
||||||
webkit: webkit,
|
webkit: webkit,
|
||||||
|
|
||||||
android: android,
|
android: android,
|
||||||
@ -875,26 +877,12 @@ L.DomUtil = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setOpacity: function (el, value) {
|
setOpacity: function (el, value) {
|
||||||
|
|
||||||
if ('opacity' in el.style) {
|
if ('opacity' in el.style) {
|
||||||
el.style.opacity = value;
|
el.style.opacity = value;
|
||||||
|
|
||||||
} else if ('filter' in el.style) {
|
} else if ('filter' in el.style) {
|
||||||
|
var filterName = 'alpha';
|
||||||
var filter = false,
|
|
||||||
filterName = 'DXImageTransform.Microsoft.Alpha';
|
|
||||||
|
|
||||||
// filters collection throws an error if we try to retrieve a filter that doesn't exist
|
|
||||||
try { filter = el.filters.item(filterName); } catch (e) {}
|
|
||||||
|
|
||||||
value = Math.round(value * 100);
|
value = Math.round(value * 100);
|
||||||
|
el.style.filter = filterName + '(opacity=' + value + ')';
|
||||||
if (filter) {
|
|
||||||
filter.Enabled = (value !== 100);
|
|
||||||
filter.Opacity = value;
|
|
||||||
} else {
|
|
||||||
el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2270,12 +2258,20 @@ L.TileLayer = L.Class.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_updateOpacity: function () {
|
_updateOpacity: function () {
|
||||||
L.DomUtil.setOpacity(this._container, this.options.opacity);
|
|
||||||
|
|
||||||
// stupid webkit hack to force redrawing of tiles
|
|
||||||
var i,
|
var i,
|
||||||
tiles = this._tiles;
|
tiles = this._tiles;
|
||||||
|
|
||||||
|
if (!L.Browser.ie7 && !L.Browser.ie8) {
|
||||||
|
L.DomUtil.setOpacity(this._container, this.options.opacity);
|
||||||
|
} else {
|
||||||
|
for (i in tiles) {
|
||||||
|
if (tiles.hasOwnProperty(i)) {
|
||||||
|
L.DomUtil.setOpacity(tiles[i], this.options.opacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// stupid webkit hack to force redrawing of tiles
|
||||||
if (L.Browser.webkit) {
|
if (L.Browser.webkit) {
|
||||||
for (i in tiles) {
|
for (i in tiles) {
|
||||||
if (tiles.hasOwnProperty(i)) {
|
if (tiles.hasOwnProperty(i)) {
|
||||||
@ -2283,6 +2279,8 @@ L.TileLayer = L.Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_initContainer: function () {
|
_initContainer: function () {
|
||||||
@ -2555,6 +2553,11 @@ L.TileLayer = L.Class.extend({
|
|||||||
_createTile: function () {
|
_createTile: function () {
|
||||||
var tile = this._tileImg.cloneNode(false);
|
var tile = this._tileImg.cloneNode(false);
|
||||||
tile.onselectstart = tile.onmousemove = L.Util.falseFn;
|
tile.onselectstart = tile.onmousemove = L.Util.falseFn;
|
||||||
|
// in IE7 and IE8 should be set per tile
|
||||||
|
if ((L.Browser.ie7 || L.Browser.ie8) && this.options.opacity !== undefined) {
|
||||||
|
L.DomUtil.setOpacity(tile, this.options.opacity);
|
||||||
|
}
|
||||||
|
|
||||||
return tile;
|
return tile;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -5435,13 +5438,13 @@ L.GeoJSON = L.FeatureGroup.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addData: function (geojson) {
|
addData: function (geojson) {
|
||||||
var features = L.Util.isArray(geojson) ? geojson : geojson.features,
|
var features = geojson instanceof Array ? geojson : geojson.features,
|
||||||
i, len;
|
i, len;
|
||||||
|
|
||||||
if (features) {
|
if (features) {
|
||||||
for (i = 0, len = features.length; i < len; i++) {
|
for (i = 0, len = features.length; i < len; i++) {
|
||||||
// Only add this if geometry or geometries are set and not null
|
// Only add this if geometry or geometries are set and not null
|
||||||
if (features[i].geometries || features[i].geometry || features[i].features) {
|
if (features[i].geometries || features[i].geometry) {
|
||||||
this.addData(features[i]);
|
this.addData(features[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5517,23 +5520,23 @@ L.extend(L.GeoJSON, {
|
|||||||
|
|
||||||
case 'Polygon':
|
case 'Polygon':
|
||||||
latlngs = this.coordsToLatLngs(coords, 1);
|
latlngs = this.coordsToLatLngs(coords, 1);
|
||||||
|
latlngs = this.removeLastPoint(latlngs, 0);
|
||||||
return new L.Polygon(latlngs);
|
return new L.Polygon(latlngs);
|
||||||
|
|
||||||
case 'MultiLineString':
|
case 'MultiLineString':
|
||||||
latlngs = this.coordsToLatLngs(coords, 1);
|
latlngs = this.coordsToLatLngs(coords, 1);
|
||||||
return new L.MultiPolyline(latlngs);
|
return new L.MultiPolyline(latlngs);
|
||||||
|
|
||||||
case 'MultiPolygon':
|
case "MultiPolygon":
|
||||||
latlngs = this.coordsToLatLngs(coords, 2);
|
latlngs = this.coordsToLatLngs(coords, 2);
|
||||||
|
// geojson closes the polygons added the frist
|
||||||
|
// coordinate at the end
|
||||||
|
latlngs = this.removeLastPoint(latlngs, 1);
|
||||||
return new L.MultiPolygon(latlngs);
|
return new L.MultiPolygon(latlngs);
|
||||||
|
|
||||||
case 'GeometryCollection':
|
case "GeometryCollection":
|
||||||
for (i = 0, len = geometry.geometries.length; i < len; i++) {
|
for (i = 0, len = geometry.geometries.length; i < len; i++) {
|
||||||
layer = this.geometryToLayer({
|
layer = this.geometryToLayer(geometry.geometries[i], pointToLayer);
|
||||||
geometry: geometry.geometries[i],
|
|
||||||
type: 'Feature',
|
|
||||||
properties: geojson.properties
|
|
||||||
}, pointToLayer);
|
|
||||||
layers.push(layer);
|
layers.push(layer);
|
||||||
}
|
}
|
||||||
return new L.FeatureGroup(layers);
|
return new L.FeatureGroup(layers);
|
||||||
@ -5543,6 +5546,21 @@ L.extend(L.GeoJSON, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// removes the last point from each array. It allows to remove the
|
||||||
|
// duplicated point GeoJSON uses to close Polygons
|
||||||
|
removeLastPoint: function (coords, levelsDeep) {
|
||||||
|
var latlng,
|
||||||
|
latlngs = [],
|
||||||
|
i, len;
|
||||||
|
for (i = 0, len = coords.length; i < len; i++) {
|
||||||
|
latlng = levelsDeep ?
|
||||||
|
this.removeLastPoint(coords[i], levelsDeep - 1) :
|
||||||
|
coords[i].slice(0, coords[i].length - 1);
|
||||||
|
latlngs.push(latlng);
|
||||||
|
}
|
||||||
|
return latlngs;
|
||||||
|
},
|
||||||
|
|
||||||
coordsToLatLng: function (coords, reverse) { // (Array, Boolean) -> LatLng
|
coordsToLatLng: function (coords, reverse) { // (Array, Boolean) -> LatLng
|
||||||
var lat = parseFloat(coords[reverse ? 0 : 1]),
|
var lat = parseFloat(coords[reverse ? 0 : 1]),
|
||||||
lng = parseFloat(coords[reverse ? 1 : 0]);
|
lng = parseFloat(coords[reverse ? 1 : 0]);
|
||||||
|
8
dist/leaflet.js
vendored
8
dist/leaflet.js
vendored
File diff suppressed because one or more lines are too long
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
var ie = !!window.ActiveXObject,
|
var ie = !!window.ActiveXObject,
|
||||||
ie6 = ie && !window.XMLHttpRequest,
|
ie6 = ie && !window.XMLHttpRequest,
|
||||||
ie7 = ie && !document.querySelector,
|
|
||||||
|
|
||||||
// terrible browser detection to work around Safari / iOS / Android browser bugs
|
// terrible browser detection to work around Safari / iOS / Android browser bugs
|
||||||
ua = navigator.userAgent.toLowerCase(),
|
ua = navigator.userAgent.toLowerCase(),
|
||||||
@ -14,6 +13,8 @@
|
|||||||
chrome = ua.indexOf('chrome') !== -1,
|
chrome = ua.indexOf('chrome') !== -1,
|
||||||
android = ua.indexOf('android') !== -1,
|
android = ua.indexOf('android') !== -1,
|
||||||
android23 = ua.search('android [23]') !== -1,
|
android23 = ua.search('android [23]') !== -1,
|
||||||
|
ie7 = ie && !document.querySelector && ua.search('msie 7') !== -1,
|
||||||
|
ie8 = ie && ua.search('msie 8') !== -1,
|
||||||
|
|
||||||
mobile = typeof orientation !== undefined + '',
|
mobile = typeof orientation !== undefined + '',
|
||||||
msTouch = window.navigator && window.navigator.msPointerEnabled &&
|
msTouch = window.navigator && window.navigator.msPointerEnabled &&
|
||||||
@ -63,6 +64,7 @@
|
|||||||
ie: ie,
|
ie: ie,
|
||||||
ie6: ie6,
|
ie6: ie6,
|
||||||
ie7: ie7,
|
ie7: ie7,
|
||||||
|
ie8: ie8,
|
||||||
webkit: webkit,
|
webkit: webkit,
|
||||||
|
|
||||||
android: android,
|
android: android,
|
||||||
|
@ -141,26 +141,12 @@ L.DomUtil = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setOpacity: function (el, value) {
|
setOpacity: function (el, value) {
|
||||||
|
|
||||||
if ('opacity' in el.style) {
|
if ('opacity' in el.style) {
|
||||||
el.style.opacity = value;
|
el.style.opacity = value;
|
||||||
|
|
||||||
} else if ('filter' in el.style) {
|
} else if ('filter' in el.style) {
|
||||||
|
var filterName = 'alpha';
|
||||||
var filter = false,
|
|
||||||
filterName = 'DXImageTransform.Microsoft.Alpha';
|
|
||||||
|
|
||||||
// filters collection throws an error if we try to retrieve a filter that doesn't exist
|
|
||||||
try { filter = el.filters.item(filterName); } catch (e) {}
|
|
||||||
|
|
||||||
value = Math.round(value * 100);
|
value = Math.round(value * 100);
|
||||||
|
el.style.filter = filterName + '(opacity=' + value + ')';
|
||||||
if (filter) {
|
|
||||||
filter.Enabled = (value !== 100);
|
|
||||||
filter.Opacity = value;
|
|
||||||
} else {
|
|
||||||
el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@ L.GeoJSON = L.FeatureGroup.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addData: function (geojson) {
|
addData: function (geojson) {
|
||||||
var features = L.Util.isArray(geojson) ? geojson : geojson.features,
|
var features = geojson instanceof Array ? geojson : geojson.features,
|
||||||
i, len;
|
i, len;
|
||||||
|
|
||||||
if (features) {
|
if (features) {
|
||||||
for (i = 0, len = features.length; i < len; i++) {
|
for (i = 0, len = features.length; i < len; i++) {
|
||||||
// Only add this if geometry or geometries are set and not null
|
// Only add this if geometry or geometries are set and not null
|
||||||
if (features[i].geometries || features[i].geometry || features[i].features) {
|
if (features[i].geometries || features[i].geometry) {
|
||||||
this.addData(features[i]);
|
this.addData(features[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,23 +97,23 @@ L.extend(L.GeoJSON, {
|
|||||||
|
|
||||||
case 'Polygon':
|
case 'Polygon':
|
||||||
latlngs = this.coordsToLatLngs(coords, 1);
|
latlngs = this.coordsToLatLngs(coords, 1);
|
||||||
|
latlngs = this.removeLastPoint(latlngs, 0);
|
||||||
return new L.Polygon(latlngs);
|
return new L.Polygon(latlngs);
|
||||||
|
|
||||||
case 'MultiLineString':
|
case 'MultiLineString':
|
||||||
latlngs = this.coordsToLatLngs(coords, 1);
|
latlngs = this.coordsToLatLngs(coords, 1);
|
||||||
return new L.MultiPolyline(latlngs);
|
return new L.MultiPolyline(latlngs);
|
||||||
|
|
||||||
case 'MultiPolygon':
|
case "MultiPolygon":
|
||||||
latlngs = this.coordsToLatLngs(coords, 2);
|
latlngs = this.coordsToLatLngs(coords, 2);
|
||||||
|
// geojson closes the polygons added the frist
|
||||||
|
// coordinate at the end
|
||||||
|
latlngs = this.removeLastPoint(latlngs, 1);
|
||||||
return new L.MultiPolygon(latlngs);
|
return new L.MultiPolygon(latlngs);
|
||||||
|
|
||||||
case 'GeometryCollection':
|
case "GeometryCollection":
|
||||||
for (i = 0, len = geometry.geometries.length; i < len; i++) {
|
for (i = 0, len = geometry.geometries.length; i < len; i++) {
|
||||||
layer = this.geometryToLayer({
|
layer = this.geometryToLayer(geometry.geometries[i], pointToLayer);
|
||||||
geometry: geometry.geometries[i],
|
|
||||||
type: 'Feature',
|
|
||||||
properties: geojson.properties
|
|
||||||
}, pointToLayer);
|
|
||||||
layers.push(layer);
|
layers.push(layer);
|
||||||
}
|
}
|
||||||
return new L.FeatureGroup(layers);
|
return new L.FeatureGroup(layers);
|
||||||
@ -123,6 +123,21 @@ L.extend(L.GeoJSON, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// removes the last point from each array. It allows to remove the
|
||||||
|
// duplicated point GeoJSON uses to close Polygons
|
||||||
|
removeLastPoint: function (coords, levelsDeep) {
|
||||||
|
var latlng,
|
||||||
|
latlngs = [],
|
||||||
|
i, len;
|
||||||
|
for (i = 0, len = coords.length; i < len; i++) {
|
||||||
|
latlng = levelsDeep ?
|
||||||
|
this.removeLastPoint(coords[i], levelsDeep - 1) :
|
||||||
|
coords[i].slice(0, coords[i].length - 1);
|
||||||
|
latlngs.push(latlng);
|
||||||
|
}
|
||||||
|
return latlngs;
|
||||||
|
},
|
||||||
|
|
||||||
coordsToLatLng: function (coords, reverse) { // (Array, Boolean) -> LatLng
|
coordsToLatLng: function (coords, reverse) { // (Array, Boolean) -> LatLng
|
||||||
var lat = parseFloat(coords[reverse ? 0 : 1]),
|
var lat = parseFloat(coords[reverse ? 0 : 1]),
|
||||||
lng = parseFloat(coords[reverse ? 1 : 0]);
|
lng = parseFloat(coords[reverse ? 1 : 0]);
|
||||||
|
@ -186,12 +186,20 @@ L.TileLayer = L.Class.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_updateOpacity: function () {
|
_updateOpacity: function () {
|
||||||
L.DomUtil.setOpacity(this._container, this.options.opacity);
|
|
||||||
|
|
||||||
// stupid webkit hack to force redrawing of tiles
|
|
||||||
var i,
|
var i,
|
||||||
tiles = this._tiles;
|
tiles = this._tiles;
|
||||||
|
|
||||||
|
if (!L.Browser.ie7 && !L.Browser.ie8) {
|
||||||
|
L.DomUtil.setOpacity(this._container, this.options.opacity);
|
||||||
|
} else {
|
||||||
|
for (i in tiles) {
|
||||||
|
if (tiles.hasOwnProperty(i)) {
|
||||||
|
L.DomUtil.setOpacity(tiles[i], this.options.opacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// stupid webkit hack to force redrawing of tiles
|
||||||
if (L.Browser.webkit) {
|
if (L.Browser.webkit) {
|
||||||
for (i in tiles) {
|
for (i in tiles) {
|
||||||
if (tiles.hasOwnProperty(i)) {
|
if (tiles.hasOwnProperty(i)) {
|
||||||
@ -199,6 +207,8 @@ L.TileLayer = L.Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_initContainer: function () {
|
_initContainer: function () {
|
||||||
@ -471,6 +481,11 @@ L.TileLayer = L.Class.extend({
|
|||||||
_createTile: function () {
|
_createTile: function () {
|
||||||
var tile = this._tileImg.cloneNode(false);
|
var tile = this._tileImg.cloneNode(false);
|
||||||
tile.onselectstart = tile.onmousemove = L.Util.falseFn;
|
tile.onselectstart = tile.onmousemove = L.Util.falseFn;
|
||||||
|
// in IE7 and IE8 should be set per tile
|
||||||
|
if ((L.Browser.ie7 || L.Browser.ie8) && this.options.opacity !== undefined) {
|
||||||
|
L.DomUtil.setOpacity(tile, this.options.opacity);
|
||||||
|
}
|
||||||
|
|
||||||
return tile;
|
return tile;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user