leaflet-geometryutil
Advanced tools
Comparing version 0.9.0 to 0.9.1
{ | ||
"name": "leaflet-geometryutil", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Leaflet utility functions on geometries", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -52,2 +52,6 @@ Leaflet.GeometryUtil | ||
### 0.9.1 ### | ||
* Fix `locateOnLine()` doesn't return correct subline (#79, thanks @lepetittim) | ||
### 0.9.0 ### | ||
@@ -54,0 +58,0 @@ |
describe('Locate on line', function() { | ||
var line = L.polyline([[0,0], [1, 1], [2, 2]]); | ||
var line_narrow_angle = L.polyline([[0,0], [0, 40], [9, 0]]) | ||
@@ -20,2 +21,8 @@ it('It should return 0 if start', function(done) { | ||
}); | ||
it('It should return ratio of point', function(done) { | ||
assert.almostEqual(0.433, L.GeometryUtil.locateOnLine(map, line_narrow_angle, L.latLng([0, 35])), 4); | ||
assert.almostEqual(0.559, L.GeometryUtil.locateOnLine(map, line_narrow_angle, L.latLng([1.5, 35])), 3); | ||
done(); | ||
}); | ||
}); |
@@ -543,3 +543,3 @@ // Packaging/modules magic dance. | ||
portion = lengths[i]; | ||
if (L.GeometryUtil.belongsSegment(point, l1, l2)) { | ||
if (L.GeometryUtil.belongsSegment(point, l1, l2, 0.0001)) { | ||
portion += l1.distanceTo(point); | ||
@@ -546,0 +546,0 @@ found = true; |
1621253
72
2370
154