Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-lasso

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-lasso - npm Package Compare versions

Comparing version 2.2.9 to 2.2.10

4

CHANGELOG.md
# Changelog
## 2.2.10
- call getBounds for all layers where available
## 2.2.9

@@ -4,0 +8,0 @@

2

dist/leaflet-lasso.cjs.js

@@ -167,3 +167,3 @@ 'use strict';

var layerBounds;
if (layer.hasOwnProperty('getBounds')) {
if ('getBounds' in layer) {
layerBounds = layer.getBounds();

@@ -170,0 +170,0 @@ }

@@ -143,3 +143,3 @@ import * as L from 'leaflet';

var layerBounds;
if (layer.hasOwnProperty('getBounds')) {
if ('getBounds' in layer) {
layerBounds = layer.getBounds();

@@ -146,0 +146,0 @@ }

@@ -879,3 +879,3 @@ (function (global, factory) {

var layerBounds;
if (layer.hasOwnProperty('getBounds')) {
if ('getBounds' in layer) {
layerBounds = layer.getBounds();

@@ -882,0 +882,0 @@ }

@@ -20,3 +20,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).LeafletLasso={},t.L)}(this,(function(t,e){"use strict";function o(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var n=o(e),r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)};

* Thu Jul 22 2021 13:58:32 GMT-0700 (Pacific Daylight Time)
*/var y=function(t,e){if(t.length!==e.length)return!1;for(var o=t.slice().sort(h),n=e.slice().sort(h),r=0;r<o.length;r++){if(o[r].length!==n[r].length)return!1;for(var i=0;i<o.length;i++)if(o[r][i]!==n[r][i])return!1}return!0},v=function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++){var l=s[a],u=l[0],c=l[1];(null===e||u<e)&&(e=u),(null===o||u>o)&&(o=u),(null===n||c<n)&&(n=c),(null===r||c>r)&&(r=c)}return[e,n,o,r]},m=function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++){var s=t[i],a=s[0],l=s[1];(null===e||a<e)&&(e=a),(null===o||a>o)&&(o=a),(null===n||l<n)&&(n=l),(null===r||l>r)&&(r=l)}return[e,n,o,r]},M=function(t){for(var e=[],o=t.features.length-1;o>=0;o--){var n=A(t.features[o].geometry);e.push([n[0],n[1]]),e.push([n[2],n[3]])}return m(e)},L=function(t){for(var e=[],o=t.geometries.length-1;o>=0;o--){var n=A(t.geometries[o]);e.push([n[0],n[1]]),e.push([n[2],n[3]])}return m(e)},A=function t(e){if(e.type)switch(e.type){case"Point":return[e.coordinates[0],e.coordinates[1],e.coordinates[0],e.coordinates[1]];case"MultiPoint":case"LineString":return m(e.coordinates);case"MultiLineString":case"Polygon":return v(e.coordinates);case"MultiPolygon":return function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++)for(var l=s[a],u=0;u<l.length;u++){var c=l[u],p=c[0],f=c[1];(null===e||p<e)&&(e=p),(null===o||p>o)&&(o=p),(null===n||f<n)&&(n=f),(null===r||f>r)&&(r=f)}return[e,n,o,r]}(e.coordinates);case"Feature":return e.geometry?t(e.geometry):null;case"FeatureCollection":return M(e);case"GeometryCollection":return L(e);default:throw new Error("Unknown type: "+e.type)}return null},b=function(t,e){if(t&&t.length){if(1===t.length)return f(t[0],e);if(f(t[0],e)){for(var o=1;o<t.length;o++)if(f(t[o],e))return!1;return!0}return!1}return!1},E=function t(e,o){var n,r,i;if("Feature"===o.type&&(o=o.geometry),"Point"===o.type&&"Point"===e.type)return d(e.coordinates,o.coordinates);if("MultiLineString"===o.type&&"Point"===e.type)for(r=0;r<e.coordinates.length;r++){if(t(e,{type:"LineString",coordinates:o.coordinates[r]}))return!0}if(("LineString"===o.type||"MultiPoint"===o.type)&&"Point"===e.type)for(r=0;r<o.coordinates.length;r++){if(e.coordinates.length!==o.coordinates[r].length)return!1;if(d(e.coordinates,o.coordinates[r]))return!0}if("Polygon"===o.type){if("Polygon"===e.type){if(o.coordinates.length===e.coordinates.length)for(r=0;r<e.coordinates.length;r++)if(y(e.coordinates[r],o.coordinates[r]))return!0;return!(!e.coordinates.length||!b(o.coordinates,e.coordinates[0][0]))&&!p(g(e.coordinates),g(o.coordinates))}if("Point"===e.type)return b(o.coordinates,e.coordinates);if("LineString"===e.type||"MultiPoint"===e.type){if(!e.coordinates||0===e.coordinates.length)return!1;for(r=0;r<e.coordinates.length;r++)if(!1===b(o.coordinates,e.coordinates[r]))return!1;return!0}if("MultiLineString"===e.type){for(r=0;r<e.coordinates.length;r++){if(!1===t({type:"LineString",coordinates:e.coordinates[r]},o))return i++,!1}return!0}if("MultiPolygon"===e.type){for(r=0;r<e.coordinates.length;r++){if(!1===t({type:"Polygon",coordinates:e.coordinates[r]},o))return!1}return!0}}if("MultiPolygon"===o.type){if("Point"===e.type){if(o.coordinates.length)for(r=0;r<o.coordinates.length;r++)if(n=o.coordinates[r],b(n,e.coordinates)&&!1===p([e.coordinates],o.coordinates))return!0;return!1}if("Polygon"===e.type){for(r=0;r<e.coordinates.length;r++)if(o.coordinates[r].length===e.coordinates.length)for(var s=0;s<e.coordinates.length;s++)if(y(e.coordinates[s],o.coordinates[r][s]))return!0;if(!1===p(e.coordinates,o.coordinates)&&o.coordinates.length){for(r=0;r<o.coordinates.length;r++)n=o.coordinates[r],i=!1!==b(n,e.coordinates[0][0]);return i}}else if("LineString"===e.type||"MultiPoint"===e.type)for(r=0;r<o.coordinates.length;r++){return!!t(e,{type:"Polygon",coordinates:o.coordinates[r]})}else{if("MultiLineString"===e.type){for(r=0;r<e.coordinates.length;r++){if(!1===t({type:"LineString",coordinates:e.coordinates[r]},o))return!1}return!0}if("MultiPolygon"===e.type){for(r=0;r<o.coordinates.length;r++){if(!1===t(e,{type:"Polygon",coordinates:o.coordinates[r]}))return!1}return!0}}}return!1},P=function(t,e){return E(e,t)},S=function t(e,o){return"Feature"===o.type&&(o=o.geometry),!(!E(e,o)&&!E(o,e))||("Point"!==e.type&&"MultiPoint"!==e.type&&"Point"!==o.type&&"MultiPoint"!==o.type?p(e.coordinates,o.coordinates):"Feature"===e.type?t(e.geometry,o):(function(){var t=Array.prototype.slice.apply(arguments);"undefined"!=typeof console&&console.warn&&console.warn.apply(console,t)}("Type "+e.type+" to "+o.type+" intersection is not supported by intersects"),!1))},w=6378137,D=6356752.3142,C=1/298.257223563,B=function(t,e,o){for(var n,r=o||64,i={type:"Polygon",coordinates:[[]]},s=0;s<r;s++)n=360*s/r,i.coordinates[0].push(O(t,n,e));return i.coordinates=g(i.coordinates),i},O=function(t,e,o){for(var n,r,i,s=w,a=D,l=C,u=t[0],c=t[1],p=o,f=Math.PI,d=e*f/180,h=Math.sin(d),g=Math.cos(d),y=(1-l)*Math.tan(c*f/180),v=1/Math.sqrt(1+y*y),m=y*v,M=Math.atan2(y,g),L=v*h,A=1-L*L,b=A*(s*s-a*a)/(a*a),E=1+b/16384*(4096+b*(b*(320-175*b)-768)),P=b/1024*(256+b*(b*(74-47*b)-128)),S=p/(a*E),B=2*Math.PI;Math.abs(S-B)>1e-12;)n=Math.cos(2*M+S),B=S,S=p/(a*E)+P*(r=Math.sin(S))*(n+P/4*((i=Math.cos(S))*(2*n*n-1)-P/6*n*(4*r*r-3)*(4*n*n-3)));var O=m*r-v*i*g,T=Math.atan2(m*i+v*r*g,(1-l)*Math.sqrt(L*L+O*O)),I=l/16*A*(4+l*(4-3*A));return[u+180*(Math.atan2(r*h,v*i-m*r*g)-(1-I)*l*L*(S+I*r*(n+I*i*(2*n*n-1))))/f,180*T/f]};function T(t,e){return function(t,e,o){var n=o||64,r=e||250;if(!t||t.length<2||!r||!n)throw new Error("Terraformer: missing parameter for Terraformer.Circle");return{type:"Feature",geometry:B(t,r,n),properties:{radius:r,center:t,steps:n}}}(n.GeoJSON.latLngToCoords(t),e).geometry}function I(t,e){return void 0===e&&(e={}),t instanceof n.Circle?T(t.getLatLng(),t.getRadius()):t instanceof n.CircleMarker?null!=e.zoom&&null!=e.crs?T(t.getLatLng(),function(t,e,o){var r=t.getLatLng(),i=e.latLngToPoint(r,o),s=t.getRadius()/Math.SQRT2,a=n.point([i.x-s,i.y-s]),l=e.pointToLatLng(a,o);return e.distance(r,l)}(t,e.crs,e.zoom)):(console.warn("Zoom and CRS is required for calculating CircleMarker polygon, falling back to center point only"),t.toGeoJSON().geometry):t instanceof n.Marker||t instanceof n.Polyline?t.toGeoJSON().geometry:void 0}function U(t,e,o){void 0===o&&(o={});var r=t.toGeoJSON().geometry,i=t.getBounds();return e.filter((function(t){var e,s,a;return t.hasOwnProperty("getBounds")?s=t.getBounds():(e=I(t,o),a=A(e),s=n.latLngBounds([a[1],a[0]],[a[3],a[2]])),!!s.isValid()&&(!!(o.intersect?i.intersects(s):i.contains(s))&&(e||(e=I(t,o)),o.intersect?function(t,e){return"Point"===e.type?P(t,e):S(t,e)}(r,e):function(t,e){return P(t,e)}(r,e)))}))}function k(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}k(".leaflet-lasso-active {\n cursor: crosshair;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.leaflet-lasso-active .leaflet-interactive {\n cursor: crosshair;\n pointer-events: none;\n}");var R="lasso.enabled",F="lasso.disabled",N="lasso.finished",G="leaflet-lasso-active",H=function(t){function e(e,o){void 0===o&&(o={});var r=t.call(this,e)||this;return r.options={polygon:{color:"#00C3FF",weight:2},intersect:!1},r.onMapMouseDownBound=r.onMapMouseDown.bind(r),r.onDocumentMouseMoveBound=r.onDocumentMouseMove.bind(r),r.onDocumentMouseUpBound=r.onDocumentMouseUp.bind(r),r.map=e,n.Util.setOptions(r,o),r}return i(e,t),e.prototype.setOptions=function(t){this.options=s(s({},this.options),t)},e.prototype.toggle=function(){this.enabled()?this.disable():this.enable()},e.prototype.addHooks=function(){this.map.getPane("mapPane"),this.map.getContainer().addEventListener("mousedown",this.onMapMouseDownBound),this.map.getContainer().addEventListener("touchstart",this.onMapMouseDownBound),this.map.getContainer().classList.add(G),this.map.dragging.disable(),this.map.fire(R)},e.prototype.removeHooks=function(){this.polygon&&(this.map.removeLayer(this.polygon),this.polygon=void 0),this.map.getContainer().removeEventListener("mousedown",this.onMapMouseDownBound),this.map.getContainer().removeEventListener("touchstart",this.onMapMouseDownBound),document.removeEventListener("mousemove",this.onDocumentMouseMoveBound),document.removeEventListener("touchmove",this.onDocumentMouseMoveBound),document.removeEventListener("mouseup",this.onDocumentMouseUpBound),document.removeEventListener("touchend",this.onDocumentMouseUpBound),this.map.getContainer().classList.remove(G),document.body.classList.remove(G),this.map.dragging.enable(),this.map.fire(F)},e.prototype.onMapMouseDown=function(t){t.stopPropagation();var e=this.eventToMouseEvent("down",t);if(e)if(t instanceof MouseEvent&&!t._simulated&&1!==t.buttons)this.disable();else if(!t.target.closest(".leaflet-control-container")){var o=this.map.mouseEventToLatLng(e);this.polygon=new l([o],this.options.polygon).addTo(this.map),document.body.classList.add(G),document.addEventListener("mousemove",this.onDocumentMouseMoveBound),document.addEventListener("touchmove",this.onDocumentMouseMoveBound),document.addEventListener("mouseup",this.onDocumentMouseUpBound),document.addEventListener("touchend",this.onDocumentMouseUpBound),t.preventDefault()}},e.prototype.onDocumentMouseMove=function(t){t.stopPropagation();var e=this.eventToMouseEvent("move",t);if(e&&this.polygon)if(t instanceof MouseEvent&&!t._simulated&&1!==t.buttons)this.finish(t);else{var o=this.map.mouseEventToLatLng(e);this.polygon.addLatLng(o),t.preventDefault()}},e.prototype.onDocumentMouseUp=function(t){this.finish(t),t.stopPropagation(),t.preventDefault()},e.prototype.eventToMouseEvent=function(t,e){return e instanceof MouseEvent?e:e instanceof TouchEvent&&1===e.touches.length?new MouseEvent(t,{screenX:e.touches[0].screenX,screenY:e.touches[0].screenY,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,buttons:1}):void 0},e.prototype.finish=function(t){var e=this;if(this.polygon){var o=[];this.map.eachLayer((function(t){t!==e.polygon&&t!==e.polygon.polyline&&t!==e.polygon.polygon&&(n.MarkerCluster&&t instanceof n.MarkerCluster?o.push.apply(o,t.getAllChildMarkers()):(t instanceof n.Marker||t instanceof n.Path)&&o.push(t))}));var r=U(this.polygon.polygon,o,{zoom:this.map.getZoom(),crs:this.map.options.crs,intersect:this.options.intersect});this.map.fire(N,{originalEvent:t,latLngs:this.polygon.getLatLngs(),layers:r}),this.disable()}},e}(n.Handler);k(".leaflet-control-lasso {\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsSAAALEgHS3X78AAAD6UlEQVR4nO1b7XHbMAwFfP0fdYKqE8QbRJ0gGUEjaAR3A4/gbuBOUHWCKhs4E1SegD06jzmYpWhJpiRKNu58Tix+AA8gCQIQK6Xolml109LfAbgDcAfg5gH4NPQEzJwSkf4kRLR2NKmJqNLfSqlqaH7+4y/0McjML0SUQdinHkO8ApCSiPZKqToogxYFAQBC50T03NDkN74raFzSGtahreSLo+9PALG7mlEXaQD6fMD0BgIp8TkQ0ZaINChpl7ExZoZxK2vcGr8nfXl2ztm5g1twI/Q6KHPvVlFg/DMgJgEAWpWCay3lIYX2zJ1bQFQhAO+i9b2l8VEEd/BSWEooBgUAm5REPvg67AGCrZDdIABgQ6qF1oOu8QBAbK4FwTd4bq23SbXeks/OIPg0f7V5TQRCpz3BNdhamH30wgu+CwFC66VqD5IIByRas/eAYDbGqi8AW+FszEp4ocC6y1KQneW6z+YmvJDDLIVDVwBKdNzPVXghi/FbLjprp4AIM2fi6loMcusal8zN8eXirOp885jNrn/BAlKxnL17GWPj+As8viqlDguwAG3V+hR7JKJvSqmyqd1KmMnrUoQHGaEzX6OVaLAfg6sRyUSeUt+UKxGobDSTmZKR5yIAj/h79IhsDPSRFxg6+ho9AAukpI1IgydGxiY4dSRON+/SXgwAyE1sHbkF79JmeEuaPs91H4DWf+Ffk1nSgDwQ0RH5iUbZqgXcAI0MG/FbKn7f+i5DZo14PabISR/lb0qpjWETXq252LmSsidaCYfh8s0pbnKZuFHuEzNvmNl5MiR9YmmRLYHaxb8VJ3SG+UzD3ZyvwyI/UEPozMoZFE2xTjOADId1yuhGBMLO0raSUSE74HsGgDoPiZULsIISPkFqtUlEuOx0YsiHadeIakTC57bGPW0zAVRiP+yVXJhY+M6JHLFcCtfDvUAoahCseoXW0Wz0Oy1310O5WUQLgmX2ZddEzkffhoc2CJMUQ3h4kzt+v7S4ke/CRKWYaBtBYURmF2tcMda7bC0absWEk5TG4ISyS3Suury1BqAB+XIMIDCv7eAEsUTvHtDQoak8bhPSexSlcXadYBlqHu8p0BMIZRVIti9QeD/Hc/S1hVawgKDuufQDriqVZeYcAjeVyL4BGBc1lcaSKY8dolaYmTXgf0ykKFStcCIKpM33Q8vuR1EcXeEuMkhoDnyWCKB81wGUQV+aEhFaJ/mSlgPwYvyHZ8QN9SlS38RbY3hnYQ/NHyH8KVq0+DdGdCgMS+sRe1ImX8xYvAUw8wGb7Q9c88/2l1sAIEPBlPM0ur85GgEPk9IdgAh4mJTuAETAw3RERP8Ab2Uzgrad13wAAAAASUVORK5CYII=');\n background-size: 22px;\n}");var Q=function(t){function e(e){void 0===e&&(e={});var o=t.call(this)||this;return o.options={position:"topright",title:"Toggle Lasso"},n.Util.setOptions(o,e),o}return i(e,t),e.prototype.setOptions=function(t){this.options=s(s({},this.options),t),this.lasso&&this.lasso.setOptions(this.options)},e.prototype.onAdd=function(t){this.lasso=new H(t,this.options);var e=n.DomUtil.create("div","leaflet-bar leaflet-control"),o=n.DomUtil.create("a","leaflet-control-lasso",e);return o.href="javascript:void(0)",o.title=this.options.title,o.setAttribute("role","button"),o.setAttribute("aria-label",o.title),n.DomEvent.addListener(o,"click",this.toggle,this),n.DomEvent.disableClickPropagation(o),e},e.prototype.enabled=function(){return!!this.lasso&&this.lasso.enabled()},e.prototype.enable=function(){this.lasso&&this.lasso.enable()},e.prototype.disable=function(){this.lasso&&this.lasso.disable()},e.prototype.toggle=function(){this.lasso&&this.lasso.toggle()},e}(n.Control);void 0!==window.L&&(window.L.Lasso=H,window.L.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(H.bind.apply(H,a([void 0],t,!1)))},window.L.Control.Lasso=Q,window.L.control.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(Q.bind.apply(Q,a([void 0],t,!1)))}),t.ACTIVE_CLASS=G,t.DISABLED_EVENT=F,t.ENABLED_EVENT=R,t.FINISHED_EVENT=N,t.LassoControl=Q,t.LassoHandler=H,Object.defineProperty(t,"__esModule",{value:!0})}));
*/var y=function(t,e){if(t.length!==e.length)return!1;for(var o=t.slice().sort(h),n=e.slice().sort(h),r=0;r<o.length;r++){if(o[r].length!==n[r].length)return!1;for(var i=0;i<o.length;i++)if(o[r][i]!==n[r][i])return!1}return!0},v=function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++){var l=s[a],u=l[0],c=l[1];(null===e||u<e)&&(e=u),(null===o||u>o)&&(o=u),(null===n||c<n)&&(n=c),(null===r||c>r)&&(r=c)}return[e,n,o,r]},m=function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++){var s=t[i],a=s[0],l=s[1];(null===e||a<e)&&(e=a),(null===o||a>o)&&(o=a),(null===n||l<n)&&(n=l),(null===r||l>r)&&(r=l)}return[e,n,o,r]},M=function(t){for(var e=[],o=t.features.length-1;o>=0;o--){var n=A(t.features[o].geometry);e.push([n[0],n[1]]),e.push([n[2],n[3]])}return m(e)},L=function(t){for(var e=[],o=t.geometries.length-1;o>=0;o--){var n=A(t.geometries[o]);e.push([n[0],n[1]]),e.push([n[2],n[3]])}return m(e)},A=function t(e){if(e.type)switch(e.type){case"Point":return[e.coordinates[0],e.coordinates[1],e.coordinates[0],e.coordinates[1]];case"MultiPoint":case"LineString":return m(e.coordinates);case"MultiLineString":case"Polygon":return v(e.coordinates);case"MultiPolygon":return function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++)for(var l=s[a],u=0;u<l.length;u++){var c=l[u],p=c[0],f=c[1];(null===e||p<e)&&(e=p),(null===o||p>o)&&(o=p),(null===n||f<n)&&(n=f),(null===r||f>r)&&(r=f)}return[e,n,o,r]}(e.coordinates);case"Feature":return e.geometry?t(e.geometry):null;case"FeatureCollection":return M(e);case"GeometryCollection":return L(e);default:throw new Error("Unknown type: "+e.type)}return null},b=function(t,e){if(t&&t.length){if(1===t.length)return f(t[0],e);if(f(t[0],e)){for(var o=1;o<t.length;o++)if(f(t[o],e))return!1;return!0}return!1}return!1},E=function t(e,o){var n,r,i;if("Feature"===o.type&&(o=o.geometry),"Point"===o.type&&"Point"===e.type)return d(e.coordinates,o.coordinates);if("MultiLineString"===o.type&&"Point"===e.type)for(r=0;r<e.coordinates.length;r++){if(t(e,{type:"LineString",coordinates:o.coordinates[r]}))return!0}if(("LineString"===o.type||"MultiPoint"===o.type)&&"Point"===e.type)for(r=0;r<o.coordinates.length;r++){if(e.coordinates.length!==o.coordinates[r].length)return!1;if(d(e.coordinates,o.coordinates[r]))return!0}if("Polygon"===o.type){if("Polygon"===e.type){if(o.coordinates.length===e.coordinates.length)for(r=0;r<e.coordinates.length;r++)if(y(e.coordinates[r],o.coordinates[r]))return!0;return!(!e.coordinates.length||!b(o.coordinates,e.coordinates[0][0]))&&!p(g(e.coordinates),g(o.coordinates))}if("Point"===e.type)return b(o.coordinates,e.coordinates);if("LineString"===e.type||"MultiPoint"===e.type){if(!e.coordinates||0===e.coordinates.length)return!1;for(r=0;r<e.coordinates.length;r++)if(!1===b(o.coordinates,e.coordinates[r]))return!1;return!0}if("MultiLineString"===e.type){for(r=0;r<e.coordinates.length;r++){if(!1===t({type:"LineString",coordinates:e.coordinates[r]},o))return i++,!1}return!0}if("MultiPolygon"===e.type){for(r=0;r<e.coordinates.length;r++){if(!1===t({type:"Polygon",coordinates:e.coordinates[r]},o))return!1}return!0}}if("MultiPolygon"===o.type){if("Point"===e.type){if(o.coordinates.length)for(r=0;r<o.coordinates.length;r++)if(n=o.coordinates[r],b(n,e.coordinates)&&!1===p([e.coordinates],o.coordinates))return!0;return!1}if("Polygon"===e.type){for(r=0;r<e.coordinates.length;r++)if(o.coordinates[r].length===e.coordinates.length)for(var s=0;s<e.coordinates.length;s++)if(y(e.coordinates[s],o.coordinates[r][s]))return!0;if(!1===p(e.coordinates,o.coordinates)&&o.coordinates.length){for(r=0;r<o.coordinates.length;r++)n=o.coordinates[r],i=!1!==b(n,e.coordinates[0][0]);return i}}else if("LineString"===e.type||"MultiPoint"===e.type)for(r=0;r<o.coordinates.length;r++){return!!t(e,{type:"Polygon",coordinates:o.coordinates[r]})}else{if("MultiLineString"===e.type){for(r=0;r<e.coordinates.length;r++){if(!1===t({type:"LineString",coordinates:e.coordinates[r]},o))return!1}return!0}if("MultiPolygon"===e.type){for(r=0;r<o.coordinates.length;r++){if(!1===t(e,{type:"Polygon",coordinates:o.coordinates[r]}))return!1}return!0}}}return!1},P=function(t,e){return E(e,t)},S=function t(e,o){return"Feature"===o.type&&(o=o.geometry),!(!E(e,o)&&!E(o,e))||("Point"!==e.type&&"MultiPoint"!==e.type&&"Point"!==o.type&&"MultiPoint"!==o.type?p(e.coordinates,o.coordinates):"Feature"===e.type?t(e.geometry,o):(function(){var t=Array.prototype.slice.apply(arguments);"undefined"!=typeof console&&console.warn&&console.warn.apply(console,t)}("Type "+e.type+" to "+o.type+" intersection is not supported by intersects"),!1))},D=6378137,w=6356752.3142,C=1/298.257223563,B=function(t,e,o){for(var n,r=o||64,i={type:"Polygon",coordinates:[[]]},s=0;s<r;s++)n=360*s/r,i.coordinates[0].push(O(t,n,e));return i.coordinates=g(i.coordinates),i},O=function(t,e,o){for(var n,r,i,s=D,a=w,l=C,u=t[0],c=t[1],p=o,f=Math.PI,d=e*f/180,h=Math.sin(d),g=Math.cos(d),y=(1-l)*Math.tan(c*f/180),v=1/Math.sqrt(1+y*y),m=y*v,M=Math.atan2(y,g),L=v*h,A=1-L*L,b=A*(s*s-a*a)/(a*a),E=1+b/16384*(4096+b*(b*(320-175*b)-768)),P=b/1024*(256+b*(b*(74-47*b)-128)),S=p/(a*E),B=2*Math.PI;Math.abs(S-B)>1e-12;)n=Math.cos(2*M+S),B=S,S=p/(a*E)+P*(r=Math.sin(S))*(n+P/4*((i=Math.cos(S))*(2*n*n-1)-P/6*n*(4*r*r-3)*(4*n*n-3)));var O=m*r-v*i*g,T=Math.atan2(m*i+v*r*g,(1-l)*Math.sqrt(L*L+O*O)),I=l/16*A*(4+l*(4-3*A));return[u+180*(Math.atan2(r*h,v*i-m*r*g)-(1-I)*l*L*(S+I*r*(n+I*i*(2*n*n-1))))/f,180*T/f]};function T(t,e){return function(t,e,o){var n=o||64,r=e||250;if(!t||t.length<2||!r||!n)throw new Error("Terraformer: missing parameter for Terraformer.Circle");return{type:"Feature",geometry:B(t,r,n),properties:{radius:r,center:t,steps:n}}}(n.GeoJSON.latLngToCoords(t),e).geometry}function I(t,e){return void 0===e&&(e={}),t instanceof n.Circle?T(t.getLatLng(),t.getRadius()):t instanceof n.CircleMarker?null!=e.zoom&&null!=e.crs?T(t.getLatLng(),function(t,e,o){var r=t.getLatLng(),i=e.latLngToPoint(r,o),s=t.getRadius()/Math.SQRT2,a=n.point([i.x-s,i.y-s]),l=e.pointToLatLng(a,o);return e.distance(r,l)}(t,e.crs,e.zoom)):(console.warn("Zoom and CRS is required for calculating CircleMarker polygon, falling back to center point only"),t.toGeoJSON().geometry):t instanceof n.Marker||t instanceof n.Polyline?t.toGeoJSON().geometry:void 0}function U(t,e,o){void 0===o&&(o={});var r=t.toGeoJSON().geometry,i=t.getBounds();return e.filter((function(t){var e,s,a;return"getBounds"in t?s=t.getBounds():(e=I(t,o),a=A(e),s=n.latLngBounds([a[1],a[0]],[a[3],a[2]])),!!s.isValid()&&(!!(o.intersect?i.intersects(s):i.contains(s))&&(e||(e=I(t,o)),o.intersect?function(t,e){return"Point"===e.type?P(t,e):S(t,e)}(r,e):function(t,e){return P(t,e)}(r,e)))}))}function k(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}k(".leaflet-lasso-active {\n cursor: crosshair;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.leaflet-lasso-active .leaflet-interactive {\n cursor: crosshair;\n pointer-events: none;\n}");var R="lasso.enabled",F="lasso.disabled",N="lasso.finished",G="leaflet-lasso-active",H=function(t){function e(e,o){void 0===o&&(o={});var r=t.call(this,e)||this;return r.options={polygon:{color:"#00C3FF",weight:2},intersect:!1},r.onMapMouseDownBound=r.onMapMouseDown.bind(r),r.onDocumentMouseMoveBound=r.onDocumentMouseMove.bind(r),r.onDocumentMouseUpBound=r.onDocumentMouseUp.bind(r),r.map=e,n.Util.setOptions(r,o),r}return i(e,t),e.prototype.setOptions=function(t){this.options=s(s({},this.options),t)},e.prototype.toggle=function(){this.enabled()?this.disable():this.enable()},e.prototype.addHooks=function(){this.map.getPane("mapPane"),this.map.getContainer().addEventListener("mousedown",this.onMapMouseDownBound),this.map.getContainer().addEventListener("touchstart",this.onMapMouseDownBound),this.map.getContainer().classList.add(G),this.map.dragging.disable(),this.map.fire(R)},e.prototype.removeHooks=function(){this.polygon&&(this.map.removeLayer(this.polygon),this.polygon=void 0),this.map.getContainer().removeEventListener("mousedown",this.onMapMouseDownBound),this.map.getContainer().removeEventListener("touchstart",this.onMapMouseDownBound),document.removeEventListener("mousemove",this.onDocumentMouseMoveBound),document.removeEventListener("touchmove",this.onDocumentMouseMoveBound),document.removeEventListener("mouseup",this.onDocumentMouseUpBound),document.removeEventListener("touchend",this.onDocumentMouseUpBound),this.map.getContainer().classList.remove(G),document.body.classList.remove(G),this.map.dragging.enable(),this.map.fire(F)},e.prototype.onMapMouseDown=function(t){t.stopPropagation();var e=this.eventToMouseEvent("down",t);if(e)if(t instanceof MouseEvent&&!t._simulated&&1!==t.buttons)this.disable();else if(!t.target.closest(".leaflet-control-container")){var o=this.map.mouseEventToLatLng(e);this.polygon=new l([o],this.options.polygon).addTo(this.map),document.body.classList.add(G),document.addEventListener("mousemove",this.onDocumentMouseMoveBound),document.addEventListener("touchmove",this.onDocumentMouseMoveBound),document.addEventListener("mouseup",this.onDocumentMouseUpBound),document.addEventListener("touchend",this.onDocumentMouseUpBound),t.preventDefault()}},e.prototype.onDocumentMouseMove=function(t){t.stopPropagation();var e=this.eventToMouseEvent("move",t);if(e&&this.polygon)if(t instanceof MouseEvent&&!t._simulated&&1!==t.buttons)this.finish(t);else{var o=this.map.mouseEventToLatLng(e);this.polygon.addLatLng(o),t.preventDefault()}},e.prototype.onDocumentMouseUp=function(t){this.finish(t),t.stopPropagation(),t.preventDefault()},e.prototype.eventToMouseEvent=function(t,e){return e instanceof MouseEvent?e:e instanceof TouchEvent&&1===e.touches.length?new MouseEvent(t,{screenX:e.touches[0].screenX,screenY:e.touches[0].screenY,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,buttons:1}):void 0},e.prototype.finish=function(t){var e=this;if(this.polygon){var o=[];this.map.eachLayer((function(t){t!==e.polygon&&t!==e.polygon.polyline&&t!==e.polygon.polygon&&(n.MarkerCluster&&t instanceof n.MarkerCluster?o.push.apply(o,t.getAllChildMarkers()):(t instanceof n.Marker||t instanceof n.Path)&&o.push(t))}));var r=U(this.polygon.polygon,o,{zoom:this.map.getZoom(),crs:this.map.options.crs,intersect:this.options.intersect});this.map.fire(N,{originalEvent:t,latLngs:this.polygon.getLatLngs(),layers:r}),this.disable()}},e}(n.Handler);k(".leaflet-control-lasso {\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsSAAALEgHS3X78AAAD6UlEQVR4nO1b7XHbMAwFfP0fdYKqE8QbRJ0gGUEjaAR3A4/gbuBOUHWCKhs4E1SegD06jzmYpWhJpiRKNu58Tix+AA8gCQIQK6Xolml109LfAbgDcAfg5gH4NPQEzJwSkf4kRLR2NKmJqNLfSqlqaH7+4y/0McjML0SUQdinHkO8ApCSiPZKqToogxYFAQBC50T03NDkN74raFzSGtahreSLo+9PALG7mlEXaQD6fMD0BgIp8TkQ0ZaINChpl7ExZoZxK2vcGr8nfXl2ztm5g1twI/Q6KHPvVlFg/DMgJgEAWpWCay3lIYX2zJ1bQFQhAO+i9b2l8VEEd/BSWEooBgUAm5REPvg67AGCrZDdIABgQ6qF1oOu8QBAbK4FwTd4bq23SbXeks/OIPg0f7V5TQRCpz3BNdhamH30wgu+CwFC66VqD5IIByRas/eAYDbGqi8AW+FszEp4ocC6y1KQneW6z+YmvJDDLIVDVwBKdNzPVXghi/FbLjprp4AIM2fi6loMcusal8zN8eXirOp885jNrn/BAlKxnL17GWPj+As8viqlDguwAG3V+hR7JKJvSqmyqd1KmMnrUoQHGaEzX6OVaLAfg6sRyUSeUt+UKxGobDSTmZKR5yIAj/h79IhsDPSRFxg6+ho9AAukpI1IgydGxiY4dSRON+/SXgwAyE1sHbkF79JmeEuaPs91H4DWf+Ffk1nSgDwQ0RH5iUbZqgXcAI0MG/FbKn7f+i5DZo14PabISR/lb0qpjWETXq252LmSsidaCYfh8s0pbnKZuFHuEzNvmNl5MiR9YmmRLYHaxb8VJ3SG+UzD3ZyvwyI/UEPozMoZFE2xTjOADId1yuhGBMLO0raSUSE74HsGgDoPiZULsIISPkFqtUlEuOx0YsiHadeIakTC57bGPW0zAVRiP+yVXJhY+M6JHLFcCtfDvUAoahCseoXW0Wz0Oy1310O5WUQLgmX2ZddEzkffhoc2CJMUQ3h4kzt+v7S4ke/CRKWYaBtBYURmF2tcMda7bC0absWEk5TG4ISyS3Suury1BqAB+XIMIDCv7eAEsUTvHtDQoak8bhPSexSlcXadYBlqHu8p0BMIZRVIti9QeD/Hc/S1hVawgKDuufQDriqVZeYcAjeVyL4BGBc1lcaSKY8dolaYmTXgf0ykKFStcCIKpM33Q8vuR1EcXeEuMkhoDnyWCKB81wGUQV+aEhFaJ/mSlgPwYvyHZ8QN9SlS38RbY3hnYQ/NHyH8KVq0+DdGdCgMS+sRe1ImX8xYvAUw8wGb7Q9c88/2l1sAIEPBlPM0ur85GgEPk9IdgAh4mJTuAETAw3RERP8Ab2Uzgrad13wAAAAASUVORK5CYII=');\n background-size: 22px;\n}");var Q=function(t){function e(e){void 0===e&&(e={});var o=t.call(this)||this;return o.options={position:"topright",title:"Toggle Lasso"},n.Util.setOptions(o,e),o}return i(e,t),e.prototype.setOptions=function(t){this.options=s(s({},this.options),t),this.lasso&&this.lasso.setOptions(this.options)},e.prototype.onAdd=function(t){this.lasso=new H(t,this.options);var e=n.DomUtil.create("div","leaflet-bar leaflet-control"),o=n.DomUtil.create("a","leaflet-control-lasso",e);return o.href="javascript:void(0)",o.title=this.options.title,o.setAttribute("role","button"),o.setAttribute("aria-label",o.title),n.DomEvent.addListener(o,"click",this.toggle,this),n.DomEvent.disableClickPropagation(o),e},e.prototype.enabled=function(){return!!this.lasso&&this.lasso.enabled()},e.prototype.enable=function(){this.lasso&&this.lasso.enable()},e.prototype.disable=function(){this.lasso&&this.lasso.disable()},e.prototype.toggle=function(){this.lasso&&this.lasso.toggle()},e}(n.Control);void 0!==window.L&&(window.L.Lasso=H,window.L.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(H.bind.apply(H,a([void 0],t,!1)))},window.L.Control.Lasso=Q,window.L.control.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(Q.bind.apply(Q,a([void 0],t,!1)))}),t.ACTIVE_CLASS=G,t.DISABLED_EVENT=F,t.ENABLED_EVENT=R,t.FINISHED_EVENT=N,t.LassoControl=Q,t.LassoHandler=H,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=leaflet-lasso.umd.min.js.map
{
"name": "leaflet-lasso",
"version": "2.2.9",
"version": "2.2.10",
"description": "Lasso selection plugin for Leaflet",

@@ -5,0 +5,0 @@ "keywords": [

@@ -40,3 +40,3 @@ # leaflet-lasso

```
<script src="https://unpkg.com/leaflet-lasso@2.2.8/dist/leaflet-lasso.umd.min.js"></script>
<script src="https://unpkg.com/leaflet-lasso@2.2.10/dist/leaflet-lasso.umd.min.js"></script>
```

@@ -43,0 +43,0 @@

@@ -62,3 +62,3 @@ import * as L from 'leaflet';

let layerBounds;
if (layer.hasOwnProperty('getBounds')) {
if ('getBounds' in layer) {
layerBounds = (layer as L.Layer & { getBounds: () => L.LatLngBounds }).getBounds();

@@ -65,0 +65,0 @@ } else {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc