Sha256: 94cfb8420f267206d3ca46e9ba7e93ba377d1553e420b0afb49fe2133d9af502

Contents?: true

Size: 563 Bytes

Versions: 6

Compression:

Stored size: 563 Bytes

Contents

describe('PolyUtil', function () {

	describe('#clipPolygon', function () {
		it('clips polygon by bounds', function () {
			var bounds = L.bounds([0, 0], [10, 10]);

			var points = [
				new L.Point(5, 5),
				new L.Point(15, 10),
				new L.Point(10, 15)
			];

			var clipped = L.PolyUtil.clipPolygon(points, bounds);

			for (var i = 0, len = clipped.length; i < len; i++) {
				delete clipped[i]._code;
			}

			expect(clipped).to.eql([
				new L.Point(7.5, 10),
				new L.Point(5, 5),
				new L.Point(10, 7.5),
				new L.Point(10, 10)
			]);
		});
	});
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
leaflet-js-0.7.0.4 lib/leaflet/spec/suites/geometry/PolyUtilSpec.js
leaflet-js-0.7.0.3 lib/leaflet/spec/suites/geometry/PolyUtilSpec.js
leaflet-js-0.7.0.2 lib/leaflet/spec/suites/geometry/PolyUtilSpec.js
leaflet-js-0.7.0.1 lib/leaflet/spec/suites/geometry/PolyUtilSpec.js
leaflet-js-0.7.0 lib/leaflet/spec/suites/geometry/PolyUtilSpec.js
leaflet-js-0.6.beta4 lib/leaflet/spec/suites/geometry/PolyUtilSpec.js