mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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.
|
||||
// With two parameters, the 2nd parameter is a direction, and infinite
|
||||
// is automatially true, since we're describing an infinite line.
|
||||
point1 = Point.read(arguments);
|
||||
point2 = Point.read(arguments);
|
||||
if (arguments.length == 3) {
|
||||
this.point = point1;
|
||||
this.vector = point2.subtract(point1);
|
||||
this.infinite = infinite;
|
||||
var _point1 = Point.read(arguments),
|
||||
_point2 = Point.read(arguments),
|
||||
_infinite = Base.readValue(arguments);
|
||||
if (_infinite !== undefined) {
|
||||
this.point = _point1;
|
||||
this.vector = _point2.subtract(_point1);
|
||||
this.infinite = _infinite;
|
||||
} else {
|
||||
this.point = point1;
|
||||
this.vector = point2;
|
||||
this.point = _point1;
|
||||
this.vector = _point2;
|
||||
this.infinite = true;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue