mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Simplify code for readRectangle() in Path.Constructors.
This commit is contained in:
parent
3f85dcdb77
commit
7553712e35
1 changed files with 7 additions and 13 deletions
|
@ -13,19 +13,13 @@
|
|||
Path.inject({ statics: new function() {
|
||||
|
||||
function readRectangle(list) {
|
||||
var props = Base.getNamed(list),
|
||||
rect;
|
||||
if (props) {
|
||||
if ('from' in props) {
|
||||
rect = new Rectangle(Point.readNamed(list, 'from'),
|
||||
Point.readNamed(list, 'to'));
|
||||
} else {
|
||||
rect = new Rectangle(props);
|
||||
}
|
||||
} else {
|
||||
rect = Rectangle.read(list);
|
||||
}
|
||||
return rect;
|
||||
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 */) {
|
||||
|
|
Loading…
Reference in a new issue