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 1.1.2 to 1.1.3

22

dist/index.js

@@ -24,7 +24,8 @@ "use strict";

document.addEventListener('mouseup', this.onMouseUpBound, true);
this.map.getContainer().style.cursor = this.options.cursor || '';
document.body.style.userSelect = 'none';
document.body.style.msUserSelect = 'none';
document.body.style.mozUserSelect = 'none'; // missing typings
document.body.style.webkitUserSelect = 'none';
var mapContainer = this.map.getContainer();
mapContainer.style.cursor = this.options.cursor || '';
mapContainer.style.userSelect = 'none';
mapContainer.style.msUserSelect = 'none';
mapContainer.style.mozUserSelect = 'none'; // missing typings
mapContainer.style.webkitUserSelect = 'none';
this.map.dragging.disable();

@@ -38,7 +39,8 @@ this.map.fire('lasso.enabled');

document.removeEventListener('mouseup', this.onMouseUpBound);
this.map.getContainer().style.cursor = '';
document.body.style.userSelect = '';
document.body.style.msUserSelect = '';
document.body.style.mozUserSelect = ''; // missing typings
document.body.style.webkitUserSelect = '';
var mapContainer = this.map.getContainer();
mapContainer.style.cursor = '';
mapContainer.style.userSelect = '';
mapContainer.style.msUserSelect = '';
mapContainer.style.mozUserSelect = ''; // missing typings
mapContainer.style.webkitUserSelect = '';
this.map.dragging.enable();

@@ -45,0 +47,0 @@ this.map.fire('lasso.disabled');

@@ -1,1 +0,1 @@

!function(e){var r={};function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)t.d(o,n,function(r){return e[r]}.bind(null,n));return o},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=4)}([function(e,r,t){"use strict";function o(e,r,t){void 0===t&&(t={});var o={type:"Feature"};return(0===t.id||t.id)&&(o.id=t.id),t.bbox&&(o.bbox=t.bbox),o.properties=r||{},o.geometry=e,o}function n(e,r,t){return void 0===t&&(t={}),o({type:"Point",coordinates:e},r,t)}function i(e,r,t){void 0===t&&(t={});for(var n=0,i=e;n<i.length;n++){var s=i[n];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:e},r,t)}function s(e,r,t){if(void 0===t&&(t={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:e},r,t)}function a(e,r){void 0===r&&(r={});var t={type:"FeatureCollection"};return r.id&&(t.id=r.id),r.bbox&&(t.bbox=r.bbox),t.features=e,t}function u(e,r,t){return void 0===t&&(t={}),o({type:"MultiLineString",coordinates:e},r,t)}function l(e,r,t){return void 0===t&&(t={}),o({type:"MultiPoint",coordinates:e},r,t)}function d(e,r,t){return void 0===t&&(t={}),o({type:"MultiPolygon",coordinates:e},r,t)}function c(e,t){void 0===t&&(t="kilometers");var o=r.factors[t];if(!o)throw new Error(t+" units is invalid");return e*o}function f(e,t){void 0===t&&(t="kilometers");var o=r.factors[t];if(!o)throw new Error(t+" units is invalid");return e/o}function m(e){return 180*(e%(2*Math.PI))/Math.PI}function h(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)&&!/^\s*$/.test(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=6371008.8,r.factors={centimeters:100*r.earthRadius,centimetres:100*r.earthRadius,degrees:r.earthRadius/111325,feet:3.28084*r.earthRadius,inches:39.37*r.earthRadius,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:1e3*r.earthRadius,millimetres:1e3*r.earthRadius,nauticalmiles:r.earthRadius/1852,radians:1,yards:r.earthRadius/1.0936},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1/1.0936},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:3.86e-7,millimeters:1e6,millimetres:1e6,yards:1.195990046},r.feature=o,r.geometry=function(e,r,t){switch(void 0===t&&(t={}),e){case"Point":return n(r).geometry;case"LineString":return s(r).geometry;case"Polygon":return i(r).geometry;case"MultiPoint":return l(r).geometry;case"MultiLineString":return u(r).geometry;case"MultiPolygon":return d(r).geometry;default:throw new Error(e+" is invalid")}},r.point=n,r.points=function(e,r,t){return void 0===t&&(t={}),a(e.map(function(e){return n(e,r)}),t)},r.polygon=i,r.polygons=function(e,r,t){return void 0===t&&(t={}),a(e.map(function(e){return i(e,r)}),t)},r.lineString=s,r.lineStrings=function(e,r,t){return void 0===t&&(t={}),a(e.map(function(e){return s(e,r)}),t)},r.featureCollection=a,r.multiLineString=u,r.multiPoint=l,r.multiPolygon=d,r.geometryCollection=function(e,r,t){return void 0===t&&(t={}),o({type:"GeometryCollection",geometries:e},r,t)},r.round=function(e,r){if(void 0===r&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var t=Math.pow(10,r||0);return Math.round(e*t)/t},r.radiansToLength=c,r.lengthToRadians=f,r.lengthToDegrees=function(e,r){return m(f(e,r))},r.bearingToAzimuth=function(e){var r=e%360;return r<0&&(r+=360),r},r.radiansToDegrees=m,r.degreesToRadians=function(e){return e%360*Math.PI/180},r.convertLength=function(e,r,t){if(void 0===r&&(r="kilometers"),void 0===t&&(t="kilometers"),!(e>=0))throw new Error("length must be a positive number");return c(f(e,r),t)},r.convertArea=function(e,t,o){if(void 0===t&&(t="meters"),void 0===o&&(o="kilometers"),!(e>=0))throw new Error("area must be a positive number");var n=r.areaFactors[t];if(!n)throw new Error("invalid original units");var i=r.areaFactors[o];if(!i)throw new Error("invalid final units");return e/n*i},r.isNumber=h,r.isObject=function(e){return!!e&&e.constructor===Object},r.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(e){if(!h(e))throw new Error("bbox must only contain numbers")})},r.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")},r.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},r.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},r.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},r.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},r.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},r.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},r.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(0);r.getCoord=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")},r.getCoords=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},r.containsNumber=function e(r){if(r.length>1&&o.isNumber(r[0])&&o.isNumber(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return e(r[0]);throw new Error("coordinates must only contain numbers")},r.geojsonType=function(e,r,t){if(!r||!t)throw new Error("type and name required");if(!e||e.type!==r)throw new Error("Invalid input to "+t+": must be a "+r+", given "+e.type)},r.featureOf=function(e,r,t){if(!e)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!e||"Feature"!==e.type||!e.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!e.geometry||e.geometry.type!==r)throw new Error("Invalid input to "+t+": must be a "+r+", given "+e.geometry.type)},r.collectionOf=function(e,r,t){if(!e)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!e||"FeatureCollection"!==e.type)throw new Error("Invalid input to "+t+", FeatureCollection required");for(var o=0,n=e.features;o<n.length;o++){var i=n[o];if(!i||"Feature"!==i.type||!i.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!i.geometry||i.geometry.type!==r)throw new Error("Invalid input to "+t+": must be a "+r+", given "+i.geometry.type)}},r.getGeom=function(e){return"Feature"===e.type?e.geometry:e},r.getType=function(e,r){return"FeatureCollection"===e.type?"FeatureCollection":"GeometryCollection"===e.type?"GeometryCollection":"Feature"===e.type&&null!==e.geometry?e.geometry.type:e.type}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(1);function n(e,r,t){var o=!1;r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]&&(r=r.slice(0,r.length-1));for(var n=0,i=r.length-1;n<r.length;i=n++){var s=r[n][0],a=r[n][1],u=r[i][0],l=r[i][1];if(e[1]*(s-u)+a*(u-e[0])+l*(e[0]-s)==0&&(s-e[0])*(u-e[0])<=0&&(a-e[1])*(l-e[1])<=0)return!t;a>e[1]!=l>e[1]&&e[0]<(u-s)*(e[1]-a)/(l-a)+s&&(o=!o)}return o}r.default=function(e,r,t){if(void 0===t&&(t={}),!e)throw new Error("point is required");if(!r)throw new Error("polygon is required");var i=o.getCoord(e),s=o.getGeom(r),a=s.type,u=r.bbox,l=s.coordinates;if(u&&!1===function(e,r){return r[0]<=e[0]&&r[1]<=e[1]&&r[2]>=e[0]&&r[3]>=e[1]}(i,u))return!1;"Polygon"===a&&(l=[l]);for(var d=!1,c=0;c<l.length&&!d;c++)if(n(i,l[c][0],t.ignoreBoundary)){for(var f=!1,m=1;m<l[c].length&&!f;)n(i,l[c][m],!t.ignoreBoundary)&&(f=!0),m++;f||(d=!0)}return d}},function(e,r){e.exports=L},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(3),n=t(2),i=o.Handler.extend({options:{polygon:{color:"#00C3FF",weight:2},cursor:"crosshair"},map:void 0,polygon:void 0,initialize:function(e,r){this.map=e,this.onMouseUpBound=this.onMouseUp.bind(this),o.Util.setOptions(this,r)},addHooks:function(){this.map.on("mousedown",this.onMouseDown,this),this.map.on("mouseup",this.onMouseUp,this),document.addEventListener("mouseup",this.onMouseUpBound,!0),this.map.getContainer().style.cursor=this.options.cursor||"",document.body.style.userSelect="none",document.body.style.msUserSelect="none",document.body.style.mozUserSelect="none",document.body.style.webkitUserSelect="none",this.map.dragging.disable(),this.map.fire("lasso.enabled")},removeHooks:function(){this.map.off("mousedown",this.onMouseDown,this),this.map.off("mousemove",this.onMouseMove,this),this.map.off("mouseup",this.onMouseUp,this),document.removeEventListener("mouseup",this.onMouseUpBound),this.map.getContainer().style.cursor="",document.body.style.userSelect="",document.body.style.msUserSelect="",document.body.style.mozUserSelect="",document.body.style.webkitUserSelect="",this.map.dragging.enable(),this.map.fire("lasso.disabled")},onMouseDown:function(e){var r=e;this.polygon=o.polygon([r.latlng],this.options.polygon).addTo(this.map),this.map.on("mousemove",this.onMouseMove,this)},onMouseMove:function(e){if(this.polygon){var r=e;this.polygon.addLatLng(r.latlng)}},onMouseUp:function(){if(this.polygon){var e=this.getSelectedLayers(this.polygon);this.map.fire("lasso.finished",{latLngs:this.polygon.getLatLngs()[0],layers:e}),this.map.removeLayer(this.polygon),this.polygon=void 0,this.disable()}},getSelectedLayers:function(e){var r=this,t=e.toGeoJSON().geometry,i=[];return this.map.eachLayer(function(e){e!==r.polygon&&(o.MarkerCluster&&e instanceof o.MarkerCluster?i.push.apply(i,e.getAllChildMarkers()):i.push(e))}),i.filter(function(e){if(e instanceof o.Marker){var r=e.toGeoJSON().geometry;return n.default(r,t)}return!1})}});o.Lasso=i,o.lasso=function(e,r){return new i(e,r)}}]);
!function(e){var r={};function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)t.d(o,n,function(r){return e[r]}.bind(null,n));return o},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=4)}([function(e,r,t){"use strict";function o(e,r,t){void 0===t&&(t={});var o={type:"Feature"};return(0===t.id||t.id)&&(o.id=t.id),t.bbox&&(o.bbox=t.bbox),o.properties=r||{},o.geometry=e,o}function n(e,r,t){return void 0===t&&(t={}),o({type:"Point",coordinates:e},r,t)}function i(e,r,t){void 0===t&&(t={});for(var n=0,i=e;n<i.length;n++){var s=i[n];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:e},r,t)}function s(e,r,t){if(void 0===t&&(t={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:e},r,t)}function a(e,r){void 0===r&&(r={});var t={type:"FeatureCollection"};return r.id&&(t.id=r.id),r.bbox&&(t.bbox=r.bbox),t.features=e,t}function u(e,r,t){return void 0===t&&(t={}),o({type:"MultiLineString",coordinates:e},r,t)}function l(e,r,t){return void 0===t&&(t={}),o({type:"MultiPoint",coordinates:e},r,t)}function d(e,r,t){return void 0===t&&(t={}),o({type:"MultiPolygon",coordinates:e},r,t)}function c(e,t){void 0===t&&(t="kilometers");var o=r.factors[t];if(!o)throw new Error(t+" units is invalid");return e*o}function f(e,t){void 0===t&&(t="kilometers");var o=r.factors[t];if(!o)throw new Error(t+" units is invalid");return e/o}function m(e){return 180*(e%(2*Math.PI))/Math.PI}function h(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)&&!/^\s*$/.test(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=6371008.8,r.factors={centimeters:100*r.earthRadius,centimetres:100*r.earthRadius,degrees:r.earthRadius/111325,feet:3.28084*r.earthRadius,inches:39.37*r.earthRadius,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:1e3*r.earthRadius,millimetres:1e3*r.earthRadius,nauticalmiles:r.earthRadius/1852,radians:1,yards:r.earthRadius/1.0936},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1/1.0936},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:3.86e-7,millimeters:1e6,millimetres:1e6,yards:1.195990046},r.feature=o,r.geometry=function(e,r,t){switch(void 0===t&&(t={}),e){case"Point":return n(r).geometry;case"LineString":return s(r).geometry;case"Polygon":return i(r).geometry;case"MultiPoint":return l(r).geometry;case"MultiLineString":return u(r).geometry;case"MultiPolygon":return d(r).geometry;default:throw new Error(e+" is invalid")}},r.point=n,r.points=function(e,r,t){return void 0===t&&(t={}),a(e.map(function(e){return n(e,r)}),t)},r.polygon=i,r.polygons=function(e,r,t){return void 0===t&&(t={}),a(e.map(function(e){return i(e,r)}),t)},r.lineString=s,r.lineStrings=function(e,r,t){return void 0===t&&(t={}),a(e.map(function(e){return s(e,r)}),t)},r.featureCollection=a,r.multiLineString=u,r.multiPoint=l,r.multiPolygon=d,r.geometryCollection=function(e,r,t){return void 0===t&&(t={}),o({type:"GeometryCollection",geometries:e},r,t)},r.round=function(e,r){if(void 0===r&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var t=Math.pow(10,r||0);return Math.round(e*t)/t},r.radiansToLength=c,r.lengthToRadians=f,r.lengthToDegrees=function(e,r){return m(f(e,r))},r.bearingToAzimuth=function(e){var r=e%360;return r<0&&(r+=360),r},r.radiansToDegrees=m,r.degreesToRadians=function(e){return e%360*Math.PI/180},r.convertLength=function(e,r,t){if(void 0===r&&(r="kilometers"),void 0===t&&(t="kilometers"),!(e>=0))throw new Error("length must be a positive number");return c(f(e,r),t)},r.convertArea=function(e,t,o){if(void 0===t&&(t="meters"),void 0===o&&(o="kilometers"),!(e>=0))throw new Error("area must be a positive number");var n=r.areaFactors[t];if(!n)throw new Error("invalid original units");var i=r.areaFactors[o];if(!i)throw new Error("invalid final units");return e/n*i},r.isNumber=h,r.isObject=function(e){return!!e&&e.constructor===Object},r.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(e){if(!h(e))throw new Error("bbox must only contain numbers")})},r.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")},r.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},r.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},r.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},r.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},r.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},r.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},r.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(0);r.getCoord=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")},r.getCoords=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},r.containsNumber=function e(r){if(r.length>1&&o.isNumber(r[0])&&o.isNumber(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return e(r[0]);throw new Error("coordinates must only contain numbers")},r.geojsonType=function(e,r,t){if(!r||!t)throw new Error("type and name required");if(!e||e.type!==r)throw new Error("Invalid input to "+t+": must be a "+r+", given "+e.type)},r.featureOf=function(e,r,t){if(!e)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!e||"Feature"!==e.type||!e.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!e.geometry||e.geometry.type!==r)throw new Error("Invalid input to "+t+": must be a "+r+", given "+e.geometry.type)},r.collectionOf=function(e,r,t){if(!e)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!e||"FeatureCollection"!==e.type)throw new Error("Invalid input to "+t+", FeatureCollection required");for(var o=0,n=e.features;o<n.length;o++){var i=n[o];if(!i||"Feature"!==i.type||!i.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!i.geometry||i.geometry.type!==r)throw new Error("Invalid input to "+t+": must be a "+r+", given "+i.geometry.type)}},r.getGeom=function(e){return"Feature"===e.type?e.geometry:e},r.getType=function(e,r){return"FeatureCollection"===e.type?"FeatureCollection":"GeometryCollection"===e.type?"GeometryCollection":"Feature"===e.type&&null!==e.geometry?e.geometry.type:e.type}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(1);function n(e,r,t){var o=!1;r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]&&(r=r.slice(0,r.length-1));for(var n=0,i=r.length-1;n<r.length;i=n++){var s=r[n][0],a=r[n][1],u=r[i][0],l=r[i][1];if(e[1]*(s-u)+a*(u-e[0])+l*(e[0]-s)==0&&(s-e[0])*(u-e[0])<=0&&(a-e[1])*(l-e[1])<=0)return!t;a>e[1]!=l>e[1]&&e[0]<(u-s)*(e[1]-a)/(l-a)+s&&(o=!o)}return o}r.default=function(e,r,t){if(void 0===t&&(t={}),!e)throw new Error("point is required");if(!r)throw new Error("polygon is required");var i=o.getCoord(e),s=o.getGeom(r),a=s.type,u=r.bbox,l=s.coordinates;if(u&&!1===function(e,r){return r[0]<=e[0]&&r[1]<=e[1]&&r[2]>=e[0]&&r[3]>=e[1]}(i,u))return!1;"Polygon"===a&&(l=[l]);for(var d=!1,c=0;c<l.length&&!d;c++)if(n(i,l[c][0],t.ignoreBoundary)){for(var f=!1,m=1;m<l[c].length&&!f;)n(i,l[c][m],!t.ignoreBoundary)&&(f=!0),m++;f||(d=!0)}return d}},function(e,r){e.exports=L},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(3),n=t(2),i=o.Handler.extend({options:{polygon:{color:"#00C3FF",weight:2},cursor:"crosshair"},map:void 0,polygon:void 0,initialize:function(e,r){this.map=e,this.onMouseUpBound=this.onMouseUp.bind(this),o.Util.setOptions(this,r)},addHooks:function(){this.map.on("mousedown",this.onMouseDown,this),this.map.on("mouseup",this.onMouseUp,this),document.addEventListener("mouseup",this.onMouseUpBound,!0);var e=this.map.getContainer();e.style.cursor=this.options.cursor||"",e.style.userSelect="none",e.style.msUserSelect="none",e.style.mozUserSelect="none",e.style.webkitUserSelect="none",this.map.dragging.disable(),this.map.fire("lasso.enabled")},removeHooks:function(){this.map.off("mousedown",this.onMouseDown,this),this.map.off("mousemove",this.onMouseMove,this),this.map.off("mouseup",this.onMouseUp,this),document.removeEventListener("mouseup",this.onMouseUpBound);var e=this.map.getContainer();e.style.cursor="",e.style.userSelect="",e.style.msUserSelect="",e.style.mozUserSelect="",e.style.webkitUserSelect="",this.map.dragging.enable(),this.map.fire("lasso.disabled")},onMouseDown:function(e){var r=e;this.polygon=o.polygon([r.latlng],this.options.polygon).addTo(this.map),this.map.on("mousemove",this.onMouseMove,this)},onMouseMove:function(e){if(this.polygon){var r=e;this.polygon.addLatLng(r.latlng)}},onMouseUp:function(){if(this.polygon){var e=this.getSelectedLayers(this.polygon);this.map.fire("lasso.finished",{latLngs:this.polygon.getLatLngs()[0],layers:e}),this.map.removeLayer(this.polygon),this.polygon=void 0,this.disable()}},getSelectedLayers:function(e){var r=this,t=e.toGeoJSON().geometry,i=[];return this.map.eachLayer(function(e){e!==r.polygon&&(o.MarkerCluster&&e instanceof o.MarkerCluster?i.push.apply(i,e.getAllChildMarkers()):i.push(e))}),i.filter(function(e){if(e instanceof o.Marker){var r=e.toGeoJSON().geometry;return n.default(r,t)}return!1})}});o.Lasso=i,o.lasso=function(e,r){return new i(e,r)}}]);
{
"name": "leaflet-lasso",
"version": "1.1.2",
"version": "1.1.3",
"description": "Leaflet plugin for lasso selection",

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

@@ -46,7 +46,8 @@ import * as L from 'leaflet';

this.map.getContainer().style.cursor = this.options.cursor || '';
document.body.style.userSelect = 'none';
document.body.style.msUserSelect = 'none';
(document.body.style as any).mozUserSelect = 'none'; // missing typings
document.body.style.webkitUserSelect = 'none';
const mapContainer = this.map.getContainer();
mapContainer.style.cursor = this.options.cursor || '';
mapContainer.style.userSelect = 'none';
mapContainer.style.msUserSelect = 'none';
(mapContainer.style as any).mozUserSelect = 'none'; // missing typings
mapContainer.style.webkitUserSelect = 'none';

@@ -63,7 +64,8 @@ this.map.dragging.disable();

this.map.getContainer().style.cursor = '';
document.body.style.userSelect = '';
document.body.style.msUserSelect = '';
(document.body.style as any).mozUserSelect = ''; // missing typings
document.body.style.webkitUserSelect = '';
const mapContainer = this.map.getContainer();
mapContainer.style.cursor = '';
mapContainer.style.userSelect = '';
mapContainer.style.msUserSelect = '';
(mapContainer.style as any).mozUserSelect = ''; // missing typings
mapContainer.style.webkitUserSelect = '';

@@ -70,0 +72,0 @@ this.map.dragging.enable();

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