mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -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() {
|
Path.inject({ statics: new function() {
|
||||||
|
|
||||||
function readRectangle(list) {
|
function readRectangle(list) {
|
||||||
var props = Base.getNamed(list),
|
var props = Base.getNamed(list);
|
||||||
rect;
|
return props
|
||||||
if (props) {
|
? 'from' in props
|
||||||
if ('from' in props) {
|
? new Rectangle(Point.readNamed(list, 'from'),
|
||||||
rect = new Rectangle(Point.readNamed(list, 'from'),
|
Point.readNamed(list, 'to'))
|
||||||
Point.readNamed(list, 'to'));
|
: new Rectangle(props)
|
||||||
} else {
|
: Rectangle.read(list);
|
||||||
rect = new Rectangle(props);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rect = Rectangle.read(list);
|
|
||||||
}
|
|
||||||
return rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRectangle(/* rect */) {
|
function createRectangle(/* rect */) {
|
||||||
|
|
Loading…
Reference in a new issue