From a3bfc8fe40c1ceec06c585974a5ba9c7f709375f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 13 Jul 2011 12:46:16 +0100 Subject: [PATCH] Support all ways of defining a Point in SegmentPoint.create(), through fallback to Point.read(). --- src/path/SegmentPoint.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/path/SegmentPoint.js b/src/path/SegmentPoint.js index 5fecb394..ec7a74f7 100644 --- a/src/path/SegmentPoint.js +++ b/src/path/SegmentPoint.js @@ -61,16 +61,16 @@ var SegmentPoint = Point.extend({ x, y, selected; if (!pt) { x = y = 0; - } else if (pt.x !== undefined) { - x = pt.x; + } else if ((x = pt[0]) !== undefined) { // Array-like + 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; 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._y = y;