Add snapping abilities on circles

This commit is contained in:
Thomas Chandelle
2017-05-23 13:11:34 +02:00
parent a1355ee766
commit 074fdeb212
4 changed files with 110 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
goog.provide('ol.test.coordinate');
goog.require('ol.coordinate');
goog.require('ol.geom.Circle');
describe('ol.coordinate', function() {
@@ -89,6 +90,19 @@ describe('ol.coordinate', function() {
});
});
describe('#closestOnCircle', function() {
var center = [5, 10];
var circle = new ol.geom.Circle(center, 10);
it('can find the closest point on circle', function() {
expect(ol.coordinate.closestOnCircle([-20, 10], circle))
.to.eql([-5, 10]);
});
it('can handle coordinate equal circle center', function() {
expect(ol.coordinate.closestOnCircle(center, circle))
.to.eql([15, 10]);
});
});
describe('#closestOnSegment', function() {
it('can handle points where the foot of the perpendicular is closest',
function() {