leaflet-forbiddenarea
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -70,3 +70,3 @@ (function() { | ||
this.options.distanceForbiddenArea, | ||
false); | ||
false, true); | ||
@@ -171,3 +171,3 @@ closest = closest || { layer: null, latlng: null }; | ||
var guides = []; | ||
marker.options.guides.forEach(function(position) { | ||
marker.options.guides.getLayers().forEach(function(position) { | ||
position._leaflet_id !== marker._leaflet_id ? guides.push(position) : null; | ||
@@ -180,3 +180,3 @@ }) | ||
marker.options.distanceForbiddenArea, | ||
false); | ||
false, false); | ||
@@ -195,3 +195,2 @@ closest = closest || { layer: null, latlng: null }; | ||
latlng = marker.getLatLng(); | ||
// set latlng initial position if forbidden area | ||
@@ -201,3 +200,3 @@ if (marker.options.forbiddenArea) { | ||
var guides = []; | ||
marker.options.guides.forEach(function(position) { | ||
marker.options.guides.getLayers().forEach(function(position) { | ||
position._leaflet_id !== marker._leaflet_id ? guides.push(position) : null; | ||
@@ -210,3 +209,4 @@ }) | ||
marker.options.distanceForbiddenArea, | ||
false); | ||
false, false); | ||
closest = closest || { layer: null, latlng: null }; | ||
@@ -270,7 +270,7 @@ this.forbiddenArea = closest.layer && closest.latlng; | ||
geomFunction = { | ||
findClosestLayer: function(map, layers, latlng, tolerance, withVertices) { | ||
var closestLayer = L.GeometryUtil.closestLayer(map, layers, latlng); | ||
findClosestLayer: function(map, layers, latlng, tolerance, withVertices, group) { | ||
var closestLayer = group ? L.GeometryUtil.closestLayer(map, layers.getLayers(), latlng) : L.GeometryUtil.closestLayer(map, layers, latlng); | ||
return closestLayer && L.GeometryUtil.length([closestLayer.latlng, latlng]) < tolerance ? closestLayer : null; | ||
} | ||
} | ||
})(); | ||
})(); |
{ | ||
"name": "leaflet-forbiddenarea", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Prohibit the placement of markers if they are too close to another layer", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -79,3 +79,3 @@ Leaflet.ForbiddenArea.js | ||
### 0.0.2 | ||
### 0.0.3 | ||
@@ -82,0 +82,0 @@ * prohibit the placement of a marker if it is too close to another.ex |
35229
538