From 4dbba5f806b010ba7cfab396dc28f0ddfccdc717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 5 Mar 2011 21:06:23 +0000 Subject: [PATCH] Make sure rectangle dimensions are not undefined when creatig from a Point or Size. --- src/basic/Rectangle.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/basic/Rectangle.js b/src/basic/Rectangle.js index e0b2fd43..03dbae31 100644 --- a/src/basic/Rectangle.js +++ b/src/basic/Rectangle.js @@ -4,10 +4,11 @@ var Rectangle = this.Rectangle = Base.extend({ initialize: function() { if (arguments.length == 1) { var rect = arguments[0]; - this.x = rect.x; - this.y = rect.y; - this.width = rect.width; - this.height = rect.height; + // Use 0 as defaults, in case we're reading from a Point or Size + this.x = rect.x || 0; + this.y = rect.y || 0; + this.width = rect.width || 0; + this.height = rect.height || 0; } else if (arguments.length == 2) { if (arguments[1].x !== undefined) { // new Rectangle(point1, point2)