From 7b7168feb1179a149dad6f7d6bcff86245731bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 3 Mar 2013 15:29:15 -0800 Subject: [PATCH] Fix reading of rectangle in Path.Constructor. And all tests are green again. --- src/path/Path.Constructors.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/path/Path.Constructors.js b/src/path/Path.Constructors.js index 50bd3b7d..7b449b24 100644 --- a/src/path/Path.Constructors.js +++ b/src/path/Path.Constructors.js @@ -12,18 +12,8 @@ Path.inject({ statics: new function() { - function readRectangle(list) { - var props = Base.getNamed(list); - return props - ? 'from' in props - ? new Rectangle(Point.readNamed(list, 'from'), - Point.readNamed(list, 'to')) - : new Rectangle(props) - : Rectangle.read(list); - } - function createRectangle(/* rect */) { - var rect = readRectangle(arguments), + var rect = Rectangle.readNamed(arguments, 'rectangle'), left = rect.getLeft(), top = rect.getTop(), right = rect.getRight(), @@ -50,7 +40,7 @@ Path.inject({ statics: new function() { ]; function createEllipse(/* rect */) { - var rect = readRectangle(arguments), + var rect = Rectangle.readNamed(arguments, 'rectangle'), path = new Path(Base.getNamed(arguments)), point = rect.getPoint(true), size = rect.getSize(true), @@ -163,7 +153,7 @@ Path.inject({ statics: new function() { * path.strokeColor = 'black'; */ RoundRectangle: function(/* rect, radius */) { - var rect = readRectangle(arguments), + var rect = Rectangle.readNamed(arguments, 'rectangle'), radius = Size.readNamed(arguments, 'radius'); if (radius.isZero()) return createRectangle(rect);