DisplayUtil.positionBounds()
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@570 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -31,6 +31,17 @@ import flash.geom.Rectangle;
|
||||
|
||||
public class DisplayUtil
|
||||
{
|
||||
/**
|
||||
* Sets the top-left pixel of a DisplayObject to the given location, taking the
|
||||
* object's bounds into account.
|
||||
*/
|
||||
public static function positionBounds (disp :DisplayObject, x :Number, y :Number) :void
|
||||
{
|
||||
var bounds :Rectangle = disp.getBounds(disp);
|
||||
disp.x = x - bounds.left;
|
||||
disp.y = y - bounds.top;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts a container's children, using ArrayUtil.stableSort.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user