Fix closed polylines not appearing on the map
This commit is contained in:
parent
171588c948
commit
0499ab73df
@ -5,8 +5,9 @@ Leaflet Changelog
|
|||||||
|
|
||||||
* Added **WMS support** (L.TileLayer.WMS), currently EPSG:3857 only. [#50](https://github.com/CloudMade/Leaflet/issues/50)
|
* Added **WMS support** (L.TileLayer.WMS), currently EPSG:3857 only. [#50](https://github.com/CloudMade/Leaflet/issues/50)
|
||||||
* Added `maxZoom` argument to `map.locateAndSetView` method.
|
* Added `maxZoom` argument to `map.locateAndSetView` method.
|
||||||
* Disabled zoom animation on Android by default because it's buggy on some devices (will be enabled back when it's stable enough). [#32](https://github.com/CloudMade/Leaflet/issues/32))
|
* Disabled zoom animation on Android by default because it's buggy on some devices (will be enabled back when it's stable enough). [#32](https://github.com/CloudMade/Leaflet/issues/32)
|
||||||
* Fixed a bug where zooming is broken if the map contains a polygon and you zoom to an area where it's not visible. [#47](https://github.com/CloudMade/Leaflet/issues/47)
|
* Fixed a bug where zooming is broken if the map contains a polygon and you zoom to an area where it's not visible. [#47](https://github.com/CloudMade/Leaflet/issues/47)
|
||||||
|
* Fixed a bug where closed polylines would not appear on the map.
|
||||||
* Improved geolocation error handling, explicit timeout. [#61](https://github.com/CloudMade/Leaflet/issues/61)
|
* Improved geolocation error handling, explicit timeout. [#61](https://github.com/CloudMade/Leaflet/issues/61)
|
||||||
* Fixed a bug where map isn't displayed in Firefox when there's an `img { max-width: 100% }` rule.
|
* Fixed a bug where map isn't displayed in Firefox when there's an `img { max-width: 100% }` rule.
|
||||||
|
|
||||||
|
@ -18,21 +18,66 @@
|
|||||||
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
||||||
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18});
|
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18});
|
||||||
|
|
||||||
for (var i = 0, latlngs = [], len = route.length; i < len; i++) {
|
|
||||||
latlngs.push(new L.LatLng(route[i][0], route[i][1]));
|
|
||||||
}
|
|
||||||
var path = new L.Polyline(latlngs);
|
|
||||||
|
|
||||||
var map = new L.Map('map', {layers: [cloudmade]});
|
var map = new L.Map('map', {layers: [cloudmade]});
|
||||||
|
|
||||||
map.fitBounds(new L.LatLngBounds(latlngs));
|
var t0p0 = new L.LatLng(42.2209295062042, 111.005859375);
|
||||||
|
var t0p1 = new L.LatLng(41.8175942893144, 108.3251953125);
|
||||||
|
var t0p2 = new L.LatLng(40.9798980696201, 105.3369140625);
|
||||||
|
var t0p3 = new L.LatLng(41.38323328651, 100.9423828125);
|
||||||
|
var t0p4 = new L.LatLng(41.693491145656, 96.943359375);
|
||||||
|
var t0p5 = new L.LatLng(43.0275999399839, 94.6142578125);
|
||||||
|
var t0p6 = new L.LatLng(44.1445282329095, 93.1201171875);
|
||||||
|
var t0p7 = new L.LatLng(44.6099150216286, 91.1865234375);
|
||||||
|
var t0p8 = new L.LatLng(45.819920672298, 89.736328125);
|
||||||
|
var t0p9 = new L.LatLng(47.2471068243697, 88.9892578125);
|
||||||
|
var t0p10 = new L.LatLng(47.929674114491, 87.5830078125);
|
||||||
|
var t0p11 = new L.LatLng(47.3712099680281, 86.30859375);
|
||||||
|
var t0p12 = new L.LatLng(46.2853074610171, 85.6494140625);
|
||||||
|
var t0p13 = new L.LatLng(45.664791742725, 83.8037109375);
|
||||||
|
var t0p14 = new L.LatLng(44.4547860920555, 82.353515625);
|
||||||
|
var t0p15 = new L.LatLng(42.8724710104108, 81.4306640625);
|
||||||
|
var t0p16 = new L.LatLng(41.5693880019976, 80.595703125);
|
||||||
|
var t0p17 = new L.LatLng(40.5214583594219, 78.8818359375);
|
||||||
|
var t0p18 = new L.LatLng(39.6045789390256, 76.025390625);
|
||||||
|
var t0p19 = new L.LatLng(37.9824076567858, 75.8056640625);
|
||||||
|
var t0p20 = new L.LatLng(36.8186760847442, 76.81640625);
|
||||||
|
var t0p21 = new L.LatLng(35.9017966643478, 78.9697265625);
|
||||||
|
var t0p22 = new L.LatLng(35.4080923610575, 80.244140625);
|
||||||
|
var t0p23 = new L.LatLng(35.9723258505322, 83.3642578125);
|
||||||
|
var t0p24 = new L.LatLng(36.1133842229009, 86.748046875);
|
||||||
|
var t0p25 = new L.LatLng(35.3728277679653, 90.5712890625);
|
||||||
|
var t0p26 = new L.LatLng(33.6801272995412, 92.021484375);
|
||||||
|
var t0p27 = new L.LatLng(32.4458665413153, 93.9111328125);
|
||||||
|
var t0p28 = new L.LatLng(31.3656905561156, 96.6796875);
|
||||||
|
var t0p29 = new L.LatLng(29.2543925012418, 99.052734375);
|
||||||
|
var t0p30 = new L.LatLng(26.7521133250951, 99.66796875);
|
||||||
|
var t0p31 = new L.LatLng(24.2498341489484, 100.1953125);
|
||||||
|
var t0p32 = new L.LatLng(23.663362467039, 101.77734375);
|
||||||
|
var t0p33 = new L.LatLng(23.7024605791663, 105.3369140625);
|
||||||
|
var t0p34 = new L.LatLng(22.7641058881113, 109.0283203125);
|
||||||
|
var t0p35 = new L.LatLng(21.9430455334382, 111.533203125);
|
||||||
|
var t0p36 = new L.LatLng(21.1861565261137, 113.3349609375);
|
||||||
|
var t0p37 = new L.LatLng(22.5686153274749, 116.5869140625);
|
||||||
|
var t0p38 = new L.LatLng(25.3836794006399, 120.05859375);
|
||||||
|
var t0p39 = new L.LatLng(27.3776831191318, 121.025390625);
|
||||||
|
var t0p40 = new L.LatLng(30.622826425697, 123.0029296875);
|
||||||
|
var t0p41 = new L.LatLng(32.375337355131, 122.2998046875);
|
||||||
|
var t0p42 = new L.LatLng(34.4206837544768, 120.4541015625);
|
||||||
|
var t0p43 = new L.LatLng(36.0075904436244, 121.2451171875);
|
||||||
|
var t0p44 = new L.LatLng(36.9597344571129, 122.8271484375);
|
||||||
|
var t0p45 = new L.LatLng(37.7355555051406, 122.6953125);
|
||||||
|
var t0p46 = new L.LatLng(38.1587306222466, 119.794921875);
|
||||||
|
var t0p47 = new L.LatLng(39.1814038219195, 120.1904296875);
|
||||||
|
var t0p48 = new L.LatLng(39.7456373113942, 120.673828125);
|
||||||
|
var t0p49 = new L.LatLng(41.5073364301684, 114.3017578125);
|
||||||
|
var t0p50 = new L.LatLng(42.158877934375, 111.4013671875);
|
||||||
|
var t0p51 = new L.LatLng(42.2209295062042, 111.005859375);
|
||||||
|
var polylinePoints0 = [t0p0,t0p1,t0p2,t0p3,t0p4,t0p5,t0p6,t0p7,t0p8,t0p9,t0p10,t0p11,t0p12,t0p13,t0p14,t0p15,t0p16,t0p17,t0p18,t0p19,t0p20,t0p21,t0p22,t0p23,t0p24,t0p25,t0p26,t0p27,t0p28,t0p29,t0p30,t0p31,t0p32,t0p33,t0p34,t0p35,t0p36,t0p37,t0p38,t0p39,t0p40,t0p41,t0p42,t0p43,t0p44,t0p45,t0p46,t0p47,t0p48,t0p49,t0p50,t0p51]
|
||||||
|
var polylineOptions0 = {color: 'blue', opacity: 0.7};
|
||||||
|
var polyline0 = new L.Polyline(polylinePoints0, polylineOptions0);
|
||||||
|
map.addLayer(polyline0);
|
||||||
|
|
||||||
map.addLayer(new L.Marker(latlngs[0]));
|
map.fitBounds(new L.LatLngBounds(polylinePoints0));
|
||||||
map.addLayer(new L.Marker(latlngs[len - 1]));
|
|
||||||
|
|
||||||
map.addLayer(path);
|
|
||||||
|
|
||||||
path.bindPopup("Hello world");
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
4
dist/leaflet.js
vendored
4
dist/leaflet.js
vendored
@ -13,8 +13,8 @@ L.Point.prototype={add:function(a){return this.clone()._add(a)},_add:function(a)
|
|||||||
Math.round(this.x);this.y=Math.round(this.y);return this},clone:function(){return new L.Point(this.x,this.y)},toString:function(){return"Point("+L.Util.formatNum(this.x)+", "+L.Util.formatNum(this.y)+")"}};L.Bounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){!this.min&&!this.max?(this.min=new L.Point(a.x,a.y),this.max=new L.Point(a.x,a.y)):(this.min.x=Math.min(a.x,this.min.x),this.max.x=Math.max(a.x,this.max.x),this.min.y=Math.min(a.y,this.min.y),this.max.y=Math.max(a.y,this.max.y))},getCenter:function(a){return new L.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,a)},contains:function(a){return a.min.x>=
|
Math.round(this.x);this.y=Math.round(this.y);return this},clone:function(){return new L.Point(this.x,this.y)},toString:function(){return"Point("+L.Util.formatNum(this.x)+", "+L.Util.formatNum(this.y)+")"}};L.Bounds=L.Class.extend({initialize:function(a,b){for(var c=a instanceof Array?a:[a,b],d=0,e=c.length;d<e;d++)this.extend(c[d])},extend:function(a){!this.min&&!this.max?(this.min=new L.Point(a.x,a.y),this.max=new L.Point(a.x,a.y)):(this.min.x=Math.min(a.x,this.min.x),this.max.x=Math.max(a.x,this.max.x),this.min.y=Math.min(a.y,this.min.y),this.max.y=Math.max(a.y,this.max.y))},getCenter:function(a){return new L.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,a)},contains:function(a){return a.min.x>=
|
||||||
this.min.x&&a.max.x<=this.max.x&&a.min.y>=this.min.y&&a.max.y<=this.max.y}});L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a;this._b=b;this._c=c;this._d=d},transform:function(a,b){return this._transform(a.clone(),b)},_transform:function(a,b){b=b||1;a.x=b*(this._a*a.x+this._b);a.y=b*(this._c*a.y+this._d);return a},untransform:function(a,b){b=b||1;return new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}});L.LineUtil={simplify:function(a,b){if(!b)return a.slice();a=this.reducePoints(a,b);return a=this.simplifyDP(a,b)},pointToSegmentDistance:function(a,b,c){return Math.sqrt(this._sqPointToSegmentDist(a,b,c))},simplifyDP:function(a,b){for(var c=0,d=0,e=b*b,f=1,g=a.length,h;f<g-1;f++)h=this._sqPointToSegmentDist(a[f],a[0],a[g-1]),h>c&&(d=f,c=h);return c>=e?(c=a.slice(0,d),d=a.slice(d),g=this.simplifyDP(c,b).slice(0,g-2),d=this.simplifyDP(d,b),g.concat(d)):[a[0],a[g-1]]},reducePoints:function(a,b){for(var c=
|
this.min.x&&a.max.x<=this.max.x&&a.min.y>=this.min.y&&a.max.y<=this.max.y}});L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a;this._b=b;this._c=c;this._d=d},transform:function(a,b){return this._transform(a.clone(),b)},_transform:function(a,b){b=b||1;a.x=b*(this._a*a.x+this._b);a.y=b*(this._c*a.y+this._d);return a},untransform:function(a,b){b=b||1;return new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}});L.LineUtil={simplify:function(a,b){if(!b)return a.slice();a=this.reducePoints(a,b);return a=this.simplifyDP(a,b)},pointToSegmentDistance:function(a,b,c){return Math.sqrt(this._sqPointToSegmentDist(a,b,c))},simplifyDP:function(a,b){for(var c=0,d=0,e=b*b,f=1,g=a.length,h;f<g-1;f++)h=this._sqPointToSegmentDist(a[f],a[0],a[g-1]),h>c&&(d=f,c=h);return c>=e?(c=a.slice(0,d),d=a.slice(d),g=this.simplifyDP(c,b).slice(0,g-2),d=this.simplifyDP(d,b),g.concat(d)):[a[0],a[g-1]]},reducePoints:function(a,b){for(var c=
|
||||||
[a[0]],d=b*b,e=1,f=0,g=a.length;e<g;e++)this._sqDist(a[e],a[f])<d||(c.push(a[e]),f=e);f<g-1&&c.push(a[g-1]);return c},clipSegment:function(a,b,c,d){d=d?this._lastCode:this._getBitCode(a,c);var e=this._getBitCode(b,c);for(this._lastCode=e;;)if(d|e)if(d&e)return!1;else{var f=d||e,g=this._getEdgeIntersection(a,b,f,c),h=this._getBitCode(g,c);f==d?(a=g,d=h):(b=g,e=h)}else return[a,b]},_getEdgeIntersection:function(a,b,c,d){var e=b.x-a.x;b=b.y-a.y;var f=d.min;d=d.max;if(c&8)return new L.Point(a.x+e*(d.y-
|
[a[0]],d=b*b,e=1,f=0,g=a.length;e<g;e++)this._sqDist(a[e],a[f])<d||(c.push(a[e]),f=e);f<g-1&&c.push(a[g-1]);return c},clipSegment:function(a,b,c,d){d=d?this._lastCode:this._getBitCode(a,c);var e=this._getBitCode(b,c);for(this._lastCode=e;;)if(d|e)if(d&e)return!1;else{var f=d||e,g=this._getEdgeIntersection(a,b,f,c),h=this._getBitCode(g,c);f==d?(a=g,d=h):(b=g,e=h)}else return[a,b]},_getEdgeIntersection:function(a,b,c,d){var e=b.x-a.x;b=b.y-a.y;var f=d.min;d=d.max;if(c&8)return new L.Point(a.x+e*(d.y-
|
||||||
a.y)/b,d.y);else if(c&4)return new L.Point(a.x+e*(f.y-a.y)/b,f.y);else if(c&2)return new L.Point(d.x,a.y+b*(d.x-a.x)/e);else if(c&1)return new L.Point(f.x,a.y+b*(f.x-a.x)/e)},_getBitCode:function(a,b){var c=0;a.x<b.min.x?c|=1:a.x>b.max.x&&(c|=2);a.y<b.min.y?c|=4:a.y>b.max.y&&(c|=8);return c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqPointToSegmentDist:function(a,b,c){var d=c.x-b.x,e=c.y-b.y,f=((a.x-b.x)*d+(a.y-b.y)*e)/this._sqDist(b,c);if(f<0)return this._sqDist(a,b);if(f>1)return this._sqDist(a,
|
a.y)/b,d.y);else if(c&4)return new L.Point(a.x+e*(f.y-a.y)/b,f.y);else if(c&2)return new L.Point(d.x,a.y+b*(d.x-a.x)/e);else if(c&1)return new L.Point(f.x,a.y+b*(f.x-a.x)/e)},_getBitCode:function(a,b){var c=0;a.x<b.min.x?c|=1:a.x>b.max.x&&(c|=2);a.y<b.min.y?c|=4:a.y>b.max.y&&(c|=8);return c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqPointToSegmentDist:function(a,b,c){var d=c.x-b.x,e=c.y-b.y;if(!d&&!e)return this._sqDist(a,b);var f=((a.x-b.x)*d+(a.y-b.y)*e)/this._sqDist(b,c);
|
||||||
c);b=new L.Point(b.x+d*f,b.y+e*f);return this._sqDist(a,b)}};L.PolyUtil={};L.PolyUtil.clipPolygon=function(a,b){var c,d=[1,4,2,8],e,f,g,h,i,j,k=L.LineUtil;e=0;for(i=a.length;e<i;e++)a[e]._code=k._getBitCode(a[e],b);for(g=0;g<4;g++){j=d[g];c=[];e=0;i=a.length;for(f=i-1;e<i;f=e++)if(h=a[e],f=a[f],h._code&j){if(!(f._code&j))f=k._getEdgeIntersection(f,h,j,b),f._code=k._getBitCode(f,b),c.push(f)}else{if(f._code&j)f=k._getEdgeIntersection(f,h,j,b),f._code=k._getBitCode(f,b),c.push(f);c.push(h)}a=c}return a};L.DomEvent={addListener:function(a,b,c,d){function e(b){return c.call(d||a,b||L.DomEvent._getEvent())}var f=L.Util.stamp(c);a["_leaflet_"+b+f]=e;L.Browser.mobileWebkit&&b=="dblclick"&&this.addDoubleTapListener?this.addDoubleTapListener(a,e,f):"addEventListener"in a?(b=="mousewheel"&&a.addEventListener("DOMMouseScroll",e,!1),a.addEventListener(b,e,!1)):"attachEvent"in a&&a.attachEvent("on"+b,e)},removeListener:function(a,b,c){c=L.Util.stamp(c);var d="_leaflet_"+b+c;handler=a[d];L.Browser.mobileWebkit&&
|
if(f<0)return this._sqDist(a,b);if(f>1)return this._sqDist(a,c);b=new L.Point(b.x+d*f,b.y+e*f);return this._sqDist(a,b)}};L.PolyUtil={};L.PolyUtil.clipPolygon=function(a,b){var c,d=[1,4,2,8],e,f,g,h,i,j,k=L.LineUtil;e=0;for(i=a.length;e<i;e++)a[e]._code=k._getBitCode(a[e],b);for(g=0;g<4;g++){j=d[g];c=[];e=0;i=a.length;for(f=i-1;e<i;f=e++)if(h=a[e],f=a[f],h._code&j){if(!(f._code&j))f=k._getEdgeIntersection(f,h,j,b),f._code=k._getBitCode(f,b),c.push(f)}else{if(f._code&j)f=k._getEdgeIntersection(f,h,j,b),f._code=k._getBitCode(f,b),c.push(f);c.push(h)}a=c}return a};L.DomEvent={addListener:function(a,b,c,d){function e(b){return c.call(d||a,b||L.DomEvent._getEvent())}var f=L.Util.stamp(c);a["_leaflet_"+b+f]=e;L.Browser.mobileWebkit&&b=="dblclick"&&this.addDoubleTapListener?this.addDoubleTapListener(a,e,f):"addEventListener"in a?(b=="mousewheel"&&a.addEventListener("DOMMouseScroll",e,!1),a.addEventListener(b,e,!1)):"attachEvent"in a&&a.attachEvent("on"+b,e)},removeListener:function(a,b,c){c=L.Util.stamp(c);var d="_leaflet_"+b+c;handler=a[d];L.Browser.mobileWebkit&&
|
||||||
b=="dblclick"&&this.removeDoubleTapListener?this.removeDoubleTapListener(a,c):"removeEventListener"in a?(b=="mousewheel"&&a.removeEventListener("DOMMouseScroll",handler,!1),a.removeEventListener(b,handler,!1)):"detachEvent"in a&&a.detachEvent("on"+b,handler);a[d]=null},_getEvent:function(){var a=window.event;if(!a)for(var b=arguments.callee.caller;b;){if((a=b.arguments[0])&&Event==a.constructor)break;b=b.caller}return a},stopPropagation:function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=
|
b=="dblclick"&&this.removeDoubleTapListener?this.removeDoubleTapListener(a,c):"removeEventListener"in a?(b=="mousewheel"&&a.removeEventListener("DOMMouseScroll",handler,!1),a.removeEventListener(b,handler,!1)):"detachEvent"in a&&a.detachEvent("on"+b,handler);a[d]=null},_getEvent:function(){var a=window.event;if(!a)for(var b=arguments.callee.caller;b;){if((a=b.arguments[0])&&Event==a.constructor)break;b=b.caller}return a},stopPropagation:function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=
|
||||||
!0},disableClickPropagation:function(a){L.DomEvent.addListener(a,"mousedown",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,"click",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,"dblclick",L.DomEvent.stopPropagation)},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},getMousePosition:function(a,b){var c=new L.Point(a.pageX?a.pageX:a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a.pageY?a.pageY:a.clientY+document.body.scrollTop+document.documentElement.scrollTop);
|
!0},disableClickPropagation:function(a){L.DomEvent.addListener(a,"mousedown",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,"click",L.DomEvent.stopPropagation);L.DomEvent.addListener(a,"dblclick",L.DomEvent.stopPropagation)},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},getMousePosition:function(a,b){var c=new L.Point(a.pageX?a.pageX:a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a.pageY?a.pageY:a.clientY+document.body.scrollTop+document.documentElement.scrollTop);
|
||||||
return b?c.subtract(L.DomUtil.getCumulativeOffset(b)):c},getWheelDelta:function(a){var b=0;a.wheelDelta&&(b=a.wheelDelta/120);a.detail&&(b=-a.detail/3);return b}};L.Util.extend(L.DomEvent,{addDoubleTapListener:function(a,b,c){function d(a){if(a.touches.length==1){var b=Date.now(),c=b-(f||b);i=a.touches[0];g=c>0&&c<=h;f=b}}function e(){if(g)i.type="dblclick",b(i),f=null}var f,g=!1,h=250,i;a["_leaflet_touchstart"+c]=d;a["_leaflet_touchend"+c]=e;a.addEventListener("touchstart",d,!1);a.addEventListener("touchend",e,!1)},removeDoubleTapListener:function(a,b){a.removeEventListener(a,a["_leaflet_touchstart"+b],!1);a.removeEventListener(a,a["_leaflet_touchend"+b],
|
return b?c.subtract(L.DomUtil.getCumulativeOffset(b)):c},getWheelDelta:function(a){var b=0;a.wheelDelta&&(b=a.wheelDelta/120);a.detail&&(b=-a.detail/3);return b}};L.Util.extend(L.DomEvent,{addDoubleTapListener:function(a,b,c){function d(a){if(a.touches.length==1){var b=Date.now(),c=b-(f||b);i=a.touches[0];g=c>0&&c<=h;f=b}}function e(){if(g)i.type="dblclick",b(i),f=null}var f,g=!1,h=250,i;a["_leaflet_touchstart"+c]=d;a["_leaflet_touchend"+c]=e;a.addEventListener("touchstart",d,!1);a.addEventListener("touchend",e,!1)},removeDoubleTapListener:function(a,b){a.removeEventListener(a,a["_leaflet_touchstart"+b],!1);a.removeEventListener(a,a["_leaflet_touchend"+b],
|
||||||
|
@ -143,8 +143,11 @@ L.LineUtil = {
|
|||||||
// square distance from point to a segment
|
// square distance from point to a segment
|
||||||
_sqPointToSegmentDist: function(p, p1, p2) {
|
_sqPointToSegmentDist: function(p, p1, p2) {
|
||||||
var x2 = p2.x - p1.x,
|
var x2 = p2.x - p1.x,
|
||||||
y2 = p2.y - p1.y,
|
y2 = p2.y - p1.y;
|
||||||
dot = (p.x - p1.x) * x2 + (p.y - p1.y) * y2,
|
|
||||||
|
if (!x2 && !y2) return this._sqDist(p, p1);
|
||||||
|
|
||||||
|
var dot = (p.x - p1.x) * x2 + (p.y - p1.y) * y2,
|
||||||
t = dot / this._sqDist(p1, p2);
|
t = dot / this._sqDist(p1, p2);
|
||||||
|
|
||||||
if (t < 0) return this._sqDist(p, p1);
|
if (t < 0) return this._sqDist(p, p1);
|
||||||
|
Loading…
Reference in New Issue
Block a user