mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix reading of center point in Rectangle constructor.
This commit is contained in:
parent
8bed8cb15d
commit
3319488f5a
1 changed files with 5 additions and 1 deletions
|
@ -92,8 +92,12 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
// See if we define the rectangle by {point, size},
|
// See if we define the rectangle by {point, size},
|
||||||
// or {center, size}
|
// or {center, size}
|
||||||
if (arg0.size) {
|
if (arg0.size) {
|
||||||
|
// We read point even if it's not defined in which case
|
||||||
|
// it's (0, 0), and set center so it can be changed at
|
||||||
|
// the end.
|
||||||
args = [Point.read([arg0.point]), Size.read([arg0.size])];
|
args = [Point.read([arg0.point]), Size.read([arg0.size])];
|
||||||
center = Point.read([arg0.center]);
|
if (arg0.center)
|
||||||
|
center = Point.read([arg0.center]);
|
||||||
} else {
|
} else {
|
||||||
// Another rectangle or a simple object literal
|
// Another rectangle or a simple object literal
|
||||||
// describing one. Use duck typing, and 0 as defaults.
|
// describing one. Use duck typing, and 0 as defaults.
|
||||||
|
|
Loading…
Reference in a new issue