mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Improve arguments reading in Line constructors.
Avoid parameter overriding.
This commit is contained in:
parent
03b5d58e79
commit
fdb4bab479
1 changed files with 9 additions and 8 deletions
|
@ -34,15 +34,16 @@ var Line = this.Line = Base.extend(/** @lends Line# */{
|
||||||
// intersection outside the line segment are allowed.
|
// intersection outside the line segment are allowed.
|
||||||
// With two parameters, the 2nd parameter is a direction, and infinite
|
// With two parameters, the 2nd parameter is a direction, and infinite
|
||||||
// is automatially true, since we're describing an infinite line.
|
// is automatially true, since we're describing an infinite line.
|
||||||
point1 = Point.read(arguments);
|
var _point1 = Point.read(arguments),
|
||||||
point2 = Point.read(arguments);
|
_point2 = Point.read(arguments),
|
||||||
if (arguments.length == 3) {
|
_infinite = Base.readValue(arguments);
|
||||||
this.point = point1;
|
if (_infinite !== undefined) {
|
||||||
this.vector = point2.subtract(point1);
|
this.point = _point1;
|
||||||
this.infinite = infinite;
|
this.vector = _point2.subtract(_point1);
|
||||||
|
this.infinite = _infinite;
|
||||||
} else {
|
} else {
|
||||||
this.point = point1;
|
this.point = _point1;
|
||||||
this.vector = point2;
|
this.vector = _point2;
|
||||||
this.infinite = true;
|
this.infinite = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue