Simplify code for readRectangle() in Path.Constructors.

This commit is contained in:
Jürg Lehni 2013-03-01 14:39:26 -08:00
parent 3f85dcdb77
commit 7553712e35

View file

@ -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 */) {