Reject zero-length lines in Line.intersectsRectangle

Because it worked that way before.
This commit is contained in:
samme 2017-01-03 13:24:57 -08:00
parent 9954130b40
commit d54478d82f

View file

@ -633,8 +633,9 @@ Phaser.Line.intersects = function (a, b, asSegment, result) {
*
* An intersection is considered valid if:
*
* The line starts within or ends within the rectangle (even for lines of length 0); or
* The line starts within or ends within the rectangle; or
* The line segment intersects one of the 4 rectangle edges; and
* The line has a non-zero length; and
* The rectangle is not empty.
*
* For the purposes of this function rectangles are considered 'solid'.
@ -647,7 +648,7 @@ Phaser.Line.intersects = function (a, b, asSegment, result) {
Phaser.Line.intersectsRectangle = function (line, rect) {
// Quick bail out
if (rect.empty)
if (line.length === 0 || rect.empty)
{
return false;
}