Handle left/right segment intersections for top/bottom spans

The ol.extent.intersectsSegment function was not correctly handling segments that span from above to below an extent while intersecting the sides.
This commit is contained in:
Tim Schaub
2015-04-19 09:43:06 -06:00
parent ed76bdb095
commit 941f53ec80
2 changed files with 22 additions and 3 deletions

View File

@@ -472,6 +472,22 @@ describe('ol.extent', function() {
expect(intersects).to.be(false);
});
it('works for left/right intersection spanning top to bottom', function() {
var extent = [2, 1, 3, 4];
var start = [0, 0];
var end = [5, 5];
expect(ol.extent.intersectsSegment(extent, start, end)).to.be(true);
expect(ol.extent.intersectsSegment(extent, end, start)).to.be(true);
});
it('works for top/bottom intersection spanning left to right', function() {
var extent = [1, 2, 4, 3];
var start = [0, 0];
var end = [5, 5];
expect(ol.extent.intersectsSegment(extent, start, end)).to.be(true);
expect(ol.extent.intersectsSegment(extent, end, start)).to.be(true);
});
});
describe('#applyTransform()', function() {