mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Support all ways of defining a Point in SegmentPoint.create(), through fallback to Point.read().
This commit is contained in:
parent
ff685f294a
commit
a3bfc8fe40
1 changed files with 8 additions and 8 deletions
|
@ -61,16 +61,16 @@ var SegmentPoint = Point.extend({
|
||||||
x, y, selected;
|
x, y, selected;
|
||||||
if (!pt) {
|
if (!pt) {
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
} else if (pt.x !== undefined) {
|
} else if ((x = pt[0]) !== undefined) { // Array-like
|
||||||
x = pt.x;
|
y = pt[1];
|
||||||
|
} else {
|
||||||
|
// If not Point-like already, read Point from pt = 3rd argument
|
||||||
|
if ((x = pt.x) === undefined) {
|
||||||
|
pt = Point.read(arguments, 2, 1);
|
||||||
|
x = pt.x;
|
||||||
|
}
|
||||||
y = pt.y;
|
y = pt.y;
|
||||||
selected = pt.selected;
|
selected = pt.selected;
|
||||||
} else if (pt.width !== undefined) {
|
|
||||||
x = pt.width;
|
|
||||||
y = pt.height;
|
|
||||||
} else {
|
|
||||||
x = pt[0];
|
|
||||||
y = pt[1];
|
|
||||||
}
|
}
|
||||||
point._x = x;
|
point._x = x;
|
||||||
point._y = y;
|
point._y = y;
|
||||||
|
|
Loading…
Reference in a new issue