Skip to content

Commit

Permalink
Fix allowIntersection / newLatLngIntersects
Browse files Browse the repository at this point in the history
  • Loading branch information
danzel committed Nov 15, 2015
1 parent 8943d99 commit a7aca25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ext/Polygon.Intersect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ L.Polygon.include({
// Checks a polygon for any intersecting line segments. Ignores holes.
intersects: function () {
var polylineIntersects,
points = this._originalPoints,
points = this._rings[0],
len, firstPoint, lastPoint, maxIndex;

if (this._tooFewPointsForIntersection()) {
Expand Down
10 changes: 5 additions & 5 deletions src/ext/Polyline.Intersect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ L.Polyline.include({
// Check to see if this polyline has any linesegments that intersect.
// NOTE: does not support detecting intersection for degenerate cases.
intersects: function () {
var points = this._originalPoints,
var points = this._rings[0],
len = points ? points.length : 0,
i, p, p1;

Expand Down Expand Up @@ -38,7 +38,7 @@ L.Polyline.include({
// newPoint must be a layer point.
// NOTE: does not support detecting intersection for degenerate cases.
newPointIntersects: function (newPoint, skipFirst) {
var points = this._originalPoints,
var points = this._rings[0],
len = points ? points.length : 0,
lastPoint = points ? points[len - 1] : null,
// The previous previous line segment. Previous line segment doesn't need testing.
Expand All @@ -54,18 +54,18 @@ L.Polyline.include({
// Polylines with 2 sides can only intersect in cases where points are collinear (we don't support detecting these).
// Cannot have intersection when < 3 line segments (< 4 points)
_tooFewPointsForIntersection: function (extraPoints) {
var points = this._originalPoints,
var points = this._rings[0],
len = points ? points.length : 0;
// Increment length by extraPoints if present
len += extraPoints || 0;

return !this._originalPoints || len <= 3;
return !this._rings[0] || len <= 3;
},

// Checks a line segment intersections with any line segments before its predecessor.
// Don't need to check the predecessor as will never intersect.
_lineSegmentsIntersectsRange: function (p, p1, maxIndex, minIndex) {
var points = this._originalPoints,
var points = this._rings[0],
p2, p3;

minIndex = minIndex || 0;
Expand Down

0 comments on commit a7aca25

Please sign in to comment.