diff --git a/src/basic/Point.js b/src/basic/Point.js index 7a4ea7c2..f1a8ee08 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -273,12 +273,15 @@ var Point = Base.extend({ statics: { read: function(args) { - if(args.length) { + if (args.length == 1 && args[0] instanceof Point) { + return args[0]; + } else if (args.length) { var point = new Point(); point.initialize.apply(point, args); return point; } }, + min: function(point1, point2) { return new Point( Math.min(point1.x, point2.x), diff --git a/src/basic/Rectangle.js b/src/basic/Rectangle.js index ff27d31a..38bd70a8 100644 --- a/src/basic/Rectangle.js +++ b/src/basic/Rectangle.js @@ -278,7 +278,9 @@ Rectangle = Base.extend({ statics: { read: function(args) { - if(args.length) { + if (args.length == 1 && args[0] instanceof Rectangle) { + return args[0]; + } else if (args.length) { var rect = new Rectangle(); rect.initialize.apply(rect, args); return rect; diff --git a/src/basic/Size.js b/src/basic/Size.js index ffac90f6..776e5295 100644 --- a/src/basic/Size.js +++ b/src/basic/Size.js @@ -88,12 +88,15 @@ var Size = Base.extend({ statics: { read: function(args) { - if(args.length) { + if (args.length == 1 && args[0] instanceof Size) { + return args[0]; + } else if (args.length) { var size = new Size(); size.initialize.apply(size, args); return size; } }, + min: function(Size1, Size2) { return new Size( Math.min(Size1.width, Size2.width), diff --git a/src/path/Segment.js b/src/path/Segment.js index 45a8b365..86e1be6f 100644 --- a/src/path/Segment.js +++ b/src/path/Segment.js @@ -135,7 +135,9 @@ Segment = Base.extend({ statics: { read: function(args) { - if(args.length && args[0] != null) { + if (args.length == 1 && args[0] instanceof Segment) { + return args[0]; + } else if (args.length && args[0] != null) { var segment = new Segment(); segment.initialize.apply(segment, args); return segment;