mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Make sure rectangle dimensions are not undefined when creatig from a Point or Size.
This commit is contained in:
parent
5392268b83
commit
4dbba5f806
1 changed files with 5 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue