Sha256: e70b67055557aaafe6691d5045589180b0c2611fa45d192404d0a1988a9b88a9

Contents?: true

Size: 782 Bytes

Versions: 10

Compression:

Stored size: 782 Bytes

Contents

L.Polygon.include({
	// Checks a polygon for any intersecting line segments. Ignores holes.
	intersects: function () {
		var polylineIntersects,
			points = this._originalPoints,
			len, firstPoint, lastPoint, maxIndex;

		if (this._tooFewPointsForIntersection()) {
			return false;
		}

		polylineIntersects = L.Polyline.prototype.intersects.call(this);

		// If already found an intersection don't need to check for any more.
		if (polylineIntersects) {
			return true;
		}

		len = points.length;
		firstPoint = points[0];
		lastPoint = points[len - 1];
		maxIndex = len - 2;

		// Check the line segment between last and first point. Don't need to check the first line segment (minIndex = 1)
		return this._lineSegmentsIntersectsRange(lastPoint, firstPoint, maxIndex, 1);
	}
});

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
leaflet-js-0.7.9 vendor/assets/Leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.7.8 vendor/assets/Leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.7.7 vendor/assets/Leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.8.dev2 lib/leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.7.0.4 lib/leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.7.0.3 lib/leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.7.0.2 lib/leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.7.0.1 lib/leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.7.0 lib/leaflet.draw/src/ext/Polygon.Intersect.js
leaflet-js-0.6.beta4 lib/leaflet.draw/src/ext/Polygon.Intersect.js