Returns a positioned rect or if it's not possible, throws an error.
If rect does not have a position, origin is used. If rect is positioned and origin is provided, returned result uses origin as x,y instead.
rect
origin
// Returns input because it's positionedgetRectPositioned({ x:1, y:2, width:10, height:20 });// Returns { x:1, y:2, width:10, height:20 }getRectPositioned({ width:10, height:20 }, { x:1, y:2 }); // Throws, because we have no pointgetRectPositioned({width:10,height:20}) Copy
// Returns input because it's positionedgetRectPositioned({ x:1, y:2, width:10, height:20 });// Returns { x:1, y:2, width:10, height:20 }getRectPositioned({ width:10, height:20 }, { x:1, y:2 }); // Throws, because we have no pointgetRectPositioned({width:10,height:20})
Optional
Returns a positioned rect or if it's not possible, throws an error.
If
rect
does not have a position,origin
is used. Ifrect
is positioned andorigin
is provided, returned result usesorigin
as x,y instead.