Build updated
This commit is contained in:
parent
e2081bdee3
commit
6c4dd07c51
@ -41,6 +41,7 @@ Leaflet Changelog
|
||||
|
||||
#### General bugfixes
|
||||
|
||||
* Fixed a bug where `Circle` was rendered with incorrect radius (didn't take projection exagerration into account). [#331](https://github.com/CloudMade/Leaflet/issues/331)
|
||||
* Fixed a bug where map panning would stuck forever after releasing the mouse over an iframe or a flash object (thanks to [@sten82](https://github.com/sten82)). [#297](https://github.com/CloudMade/Leaflet/pull/297) [#64](https://github.com/CloudMade/Leaflet/issues/64)
|
||||
* Fixed a bug where mouse zoom worked incorrectly if map is inside scrolled container (partially by [@chrillo](https://github.com/chrillo)). [#206](https://github.com/CloudMade/Leaflet/issues/206)
|
||||
* Fixed a bug where it was possible to add the same listener twice. [#281](https://github.com/CloudMade/Leaflet/issues/281)
|
||||
|
4
dist/leaflet.js
vendored
4
dist/leaflet.js
vendored
@ -108,8 +108,8 @@ c=this._pathRoot;L.DomUtil.setPosition(c,b);c.width=a.x;c.height=a.y;c.getContex
|
||||
a;this._redraw();return this},addLatLng:function(a){this._latlngs.push(a);this._redraw();return this},spliceLatLngs:function(){var a=[].splice.apply(this._latlngs,arguments);this._redraw();return a},closestLayerPoint:function(a){for(var b=Infinity,c=this._parts,d,e,f=null,g=0,h=c.length;g<h;g++)for(var j=c[g],k=1,l=j.length;k<l;k++)if(d=j[k-1],e=j[k],d=L.LineUtil._sqClosestPointOnSegment(a,d,e),d._sqDist<b)b=d._sqDist,f=d;if(f)f.distance=Math.sqrt(b);return f},getBounds:function(){for(var a=new L.LatLngBounds,
|
||||
b=this.getLatLngs(),c=0,d=b.length;c<d;c++)a.extend(b[c]);return a},_getPathPartStr:function(a){for(var b=L.Path.VML,c=0,d=a.length,e="",f;c<d;c++)f=a[c],b&&f._round(),e+=(c?"L":"M")+f.x+" "+f.y;return e},_clipPoints:function(){var a=this._originalPoints,b=a.length,c,d,e;if(this.options.noClip)this._parts=[a];else{var f=this._parts=[],g=this._map._pathViewport,h=L.LineUtil;for(d=c=0;c<b-1;c++)if(e=h.clipSegment(a[c],a[c+1],g,c))if(f[d]=f[d]||[],f[d].push(e[0]),e[1]!=a[c+1]||c==b-2)f[d].push(e[1]),
|
||||
d++}},_simplifyPoints:function(){for(var a=this._parts,b=L.LineUtil,c=0,d=a.length;c<d;c++)a[c]=b.simplify(a[c],this.options.smoothFactor)},_updatePath:function(){this._clipPoints();this._simplifyPoints();L.Path.prototype._updatePath.call(this)}});L.Polyline.include(!L.Path.CANVAS?{}:{_containsPoint:function(a,b){var c,d,e,f,g,h,j=this.options.weight/2;L.Browser.touch&&(j+=10);c=0;for(f=this._parts.length;c<f;c++){h=this._parts[c];d=0;g=h.length;for(e=g-1;d<g;e=d++)if(b||d!==0)if(e=L.LineUtil.pointToSegmentDistance(a,h[e],h[d]),e<=j)return!0}return!1}});L.Polygon=L.Polyline.extend({options:{fill:!0},initialize:function(a,b){L.Polyline.prototype.initialize.call(this,a,b);if(a[0]instanceof Array)this._latlngs=a[0],this._holes=a.slice(1)},projectLatlngs:function(){L.Polyline.prototype.projectLatlngs.call(this);this._holePoints=[];if(this._holes)for(var a=0,b=this._holes.length;a<b;a++){this._holePoints[a]=[];for(var c=0,d=this._holes[a].length;c<d;c++)this._holePoints[a][c]=this._map.latLngToLayerPoint(this._holes[a][c])}},_clipPoints:function(){var a=
|
||||
[];this._parts=[this._originalPoints].concat(this._holePoints);if(!this.options.noClip){for(var b=0,c=this._parts.length;b<c;b++){var d=L.PolyUtil.clipPolygon(this._parts[b],this._map._pathViewport);d.length&&a.push(d)}this._parts=a}},_getPathPartStr:function(a){return L.Polyline.prototype._getPathPartStr.call(this,a)+(L.Browser.svg?"z":"x")}});L.Polygon.include(!L.Path.CANVAS?{}:{_containsPoint:function(a){var b=!1,c,d,e,f,g,h,j;if(L.Polyline.prototype._containsPoint.call(this,a,!0))return!0;f=0;for(h=this._parts.length;f<h;f++){c=this._parts[f];g=0;j=c.length;for(e=j-1;g<j;e=g++)d=c[g],e=c[e],d.y>a.y!=e.y>a.y&&a.x<(e.x-d.x)*(a.y-d.y)/(e.y-d.y)+d.x&&(b=!b)}return b}});(function(){function a(a){return L.FeatureGroup.extend({initialize:function(a,b){this._layers={};this._options=b;this.setLatLngs(a)},setStyle:function(a){for(var b in this._layers)this._layers.hasOwnProperty(b)&&this._layers[b].setStyle&&this._layers[b].setStyle(a)},setLatLngs:function(c){var d=0,e=c.length;for(this._iterateLayers(function(a){d<e?a.setLatLngs(c[d++]):this.removeLayer(a)},this);d<e;)this.addLayer(new a(c[d++],this._options))}})}L.MultiPolyline=a(L.Polyline);L.MultiPolygon=a(L.Polygon)})();L.Circle=L.Path.extend({initialize:function(a,b,c){L.Path.prototype.initialize.call(this,c);this._latlng=a;this._mRadius=b},options:{fill:!0},setLatLng:function(a){this._latlng=a;this._redraw();return this},setRadius:function(a){this._mRadius=a;this._redraw();return this},projectLatlngs:function(){var a=this._map.options.scale(this._map._zoom);this._point=this._map.latLngToLayerPoint(this._latlng);this._radius=this._mRadius/40075017*a},getPathString:function(){var a=this._point,b=this._radius;if(this._checkIfEmpty())return"";
|
||||
return L.Browser.svg?"M"+a.x+","+(a.y-b)+"A"+b+","+b+",0,1,1,"+(a.x-0.1)+","+(a.y-b)+" z":(a._round(),b=Math.round(b),"AL "+a.x+","+a.y+" "+b+","+b+" 0,23592600")},_checkIfEmpty:function(){var a=this._map._pathViewport,b=this._radius,c=this._point;return c.x-b>a.max.x||c.y-b>a.max.y||c.x+b<a.min.x||c.y+b<a.min.y}});L.Circle.include(!L.Path.CANVAS?{}:{_drawPath:function(){var a=this._point;this._ctx.beginPath();this._ctx.arc(a.x,a.y,this._radius,0,Math.PI*2)},_containsPoint:function(a){var b=this.options.stroke?this.options.weight/2:0;return a.distanceTo(this._point)<=this._radius+b}});L.CircleMarker=L.Circle.extend({options:{radius:10,weight:2},initialize:function(a,b){L.Circle.prototype.initialize.call(this,a,null,b);this._radius=this.options.radius},projectLatlngs:function(){this._point=this._map.latLngToLayerPoint(this._latlng)},setRadius:function(a){this._radius=a;this._redraw();return this}});L.GeoJSON=L.FeatureGroup.extend({initialize:function(a,b){L.Util.setOptions(this,b);this._geojson=a;this._layers={};a&&this.addGeoJSON(a)},addGeoJSON:function(a){if(a.features)for(var b=0,c=a.features.length;b<c;b++)this.addGeoJSON(a.features[b]);else b=a.type=="Feature"?a.geometry:a,c=L.GeoJSON.geometryToLayer(b,this.options.pointToLayer),this.fire("featureparse",{layer:c,properties:a.properties,geometryType:b.type,bbox:a.bbox,id:a.id}),this.addLayer(c)}});
|
||||
[];this._parts=[this._originalPoints].concat(this._holePoints);if(!this.options.noClip){for(var b=0,c=this._parts.length;b<c;b++){var d=L.PolyUtil.clipPolygon(this._parts[b],this._map._pathViewport);d.length&&a.push(d)}this._parts=a}},_getPathPartStr:function(a){return L.Polyline.prototype._getPathPartStr.call(this,a)+(L.Browser.svg?"z":"x")}});L.Polygon.include(!L.Path.CANVAS?{}:{_containsPoint:function(a){var b=!1,c,d,e,f,g,h,j;if(L.Polyline.prototype._containsPoint.call(this,a,!0))return!0;f=0;for(h=this._parts.length;f<h;f++){c=this._parts[f];g=0;j=c.length;for(e=j-1;g<j;e=g++)d=c[g],e=c[e],d.y>a.y!=e.y>a.y&&a.x<(e.x-d.x)*(a.y-d.y)/(e.y-d.y)+d.x&&(b=!b)}return b}});(function(){function a(a){return L.FeatureGroup.extend({initialize:function(a,b){this._layers={};this._options=b;this.setLatLngs(a)},setStyle:function(a){for(var b in this._layers)this._layers.hasOwnProperty(b)&&this._layers[b].setStyle&&this._layers[b].setStyle(a)},setLatLngs:function(c){var d=0,e=c.length;for(this._iterateLayers(function(a){d<e?a.setLatLngs(c[d++]):this.removeLayer(a)},this);d<e;)this.addLayer(new a(c[d++],this._options))}})}L.MultiPolyline=a(L.Polyline);L.MultiPolygon=a(L.Polygon)})();L.Circle=L.Path.extend({initialize:function(a,b,c){L.Path.prototype.initialize.call(this,c);this._latlng=a;this._mRadius=b},options:{fill:!0},setLatLng:function(a){this._latlng=a;this._redraw();return this},setRadius:function(a){this._mRadius=a;this._redraw();return this},projectLatlngs:function(){var a=this._map.latLngToLayerPoint(new L.LatLng(this._latlng.lat,this._latlng.lng-this._mRadius/(40075017*Math.cos(L.LatLng.DEG_TO_RAD*this._latlng.lat))*360,!0));this._point=this._map.latLngToLayerPoint(this._latlng);
|
||||
this._radius=Math.round(this._point.x-a.x)},getPathString:function(){var a=this._point,b=this._radius;if(this._checkIfEmpty())return"";return L.Browser.svg?"M"+a.x+","+(a.y-b)+"A"+b+","+b+",0,1,1,"+(a.x-0.1)+","+(a.y-b)+" z":(a._round(),b=Math.round(b),"AL "+a.x+","+a.y+" "+b+","+b+" 0,23592600")},_checkIfEmpty:function(){var a=this._map._pathViewport,b=this._radius,c=this._point;return c.x-b>a.max.x||c.y-b>a.max.y||c.x+b<a.min.x||c.y+b<a.min.y}});L.Circle.include(!L.Path.CANVAS?{}:{_drawPath:function(){var a=this._point;this._ctx.beginPath();this._ctx.arc(a.x,a.y,this._radius,0,Math.PI*2)},_containsPoint:function(a){var b=this.options.stroke?this.options.weight/2:0;return a.distanceTo(this._point)<=this._radius+b}});L.CircleMarker=L.Circle.extend({options:{radius:10,weight:2},initialize:function(a,b){L.Circle.prototype.initialize.call(this,a,null,b);this._radius=this.options.radius},projectLatlngs:function(){this._point=this._map.latLngToLayerPoint(this._latlng)},setRadius:function(a){this._radius=a;this._redraw();return this}});L.GeoJSON=L.FeatureGroup.extend({initialize:function(a,b){L.Util.setOptions(this,b);this._geojson=a;this._layers={};a&&this.addGeoJSON(a)},addGeoJSON:function(a){if(a.features)for(var b=0,c=a.features.length;b<c;b++)this.addGeoJSON(a.features[b]);else b=a.type=="Feature"?a.geometry:a,c=L.GeoJSON.geometryToLayer(b,this.options.pointToLayer),this.fire("featureparse",{layer:c,properties:a.properties,geometryType:b.type,bbox:a.bbox,id:a.id}),this.addLayer(c)}});
|
||||
L.Util.extend(L.GeoJSON,{geometryToLayer:function(a,b){var c=a.coordinates,d,e,f,g=[];switch(a.type){case "Point":return d=this.coordsToLatLng(c),b?b(d):new L.Marker(d);case "MultiPoint":e=0;for(f=c.length;e<f;e++)d=this.coordsToLatLng(c[e]),d=b?b(d):new L.Marker(d),g.push(d);return new L.FeatureGroup(g);case "LineString":return c=this.coordsToLatLngs(c),new L.Polyline(c);case "Polygon":return c=this.coordsToLatLngs(c,1),new L.Polygon(c);case "MultiLineString":return c=this.coordsToLatLngs(c,1),new L.MultiPolyline(c);
|
||||
case "MultiPolygon":return c=this.coordsToLatLngs(c,2),new L.MultiPolygon(c);case "GeometryCollection":e=0;for(f=a.geometries.length;e<f;e++)d=this.geometryToLayer(a.geometries[e]),g.push(d);return new L.FeatureGroup(g);default:throw Error("Invalid GeoJSON object.");}},coordsToLatLng:function(a,b){var c=parseFloat(a[b?0:1]),d=parseFloat(a[b?1:0]);return new L.LatLng(c,d)},coordsToLatLngs:function(a,b,c){var d,e=[],f,g=a.length;for(f=0;f<g;f++)d=b?this.coordsToLatLngs(a[f],b-1,c):this.coordsToLatLng(a[f],
|
||||
c),e.push(d);return e}});L.Handler=L.Class.extend({initialize:function(a){this._map=a},enabled:function(){return!!this._enabled}});L.Handler.MapDrag=L.Handler.extend({enable:function(){if(!this._enabled){if(!this._draggable){this._draggable=new L.Draggable(this._map._mapPane,this._map._container);this._draggable.on("dragstart",this._onDragStart,this);this._draggable.on("drag",this._onDrag,this);this._draggable.on("dragend",this._onDragEnd,this);var a=this._map.options;a.worldCopyJump&&!a.continuousWorld&&(this._draggable.on("predrag",this._onPreDrag,this),this._map.on("viewreset",this._onViewReset,this))}this._draggable.enable();
|
||||
|
@ -28,10 +28,14 @@ L.Circle = L.Path.extend({
|
||||
|
||||
projectLatlngs: function() {
|
||||
var equatorLength = 40075017,
|
||||
scale = this._map.options.scale(this._map._zoom);
|
||||
|
||||
hLength = equatorLength * Math.cos(L.LatLng.DEG_TO_RAD * this._latlng.lat);
|
||||
|
||||
var lngSpan = (this._mRadius / hLength) * 360,
|
||||
latlng2 = new L.LatLng(this._latlng.lat, this._latlng.lng - lngSpan, true),
|
||||
point2 = this._map.latLngToLayerPoint(latlng2);
|
||||
|
||||
this._point = this._map.latLngToLayerPoint(this._latlng);
|
||||
this._radius = (this._mRadius / equatorLength) * scale;
|
||||
this._radius = Math.round(this._point.x - point2.x);
|
||||
},
|
||||
|
||||
getPathString: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user